clear all

use "./UKDA-8381-stata/stata/stata11/lfsp_aj18_eul", clear // Apr-Jun18

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 

tab SC10MMJ ILODEFR if SEX == 1  [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl_m = x[3,1]
gen maj2_empl_m = x[4,1]
gen maj3_empl_m = x[5,1]
gen maj4_empl_m = x[6,1]
gen maj5_empl_m = x[7,1]
gen maj6_empl_m = x[8,1]
gen maj7_empl_m = x[9,1]
gen maj8_empl_m = x[10,1]
gen maj9_empl_m = x[11,1]

tab SC10MMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(xf)

matrix list xf

gen maj1_empl_f = xf[3,1]
gen maj2_empl_f = xf[4,1]
gen maj3_empl_f = xf[5,1]
gen maj4_empl_f = xf[6,1]
gen maj5_empl_f = xf[7,1]
gen maj6_empl_f = xf[8,1]
gen maj7_empl_f = xf[9,1]
gen maj8_empl_f = xf[10,1]
gen maj9_empl_f = xf[11,1]


tab SC10LMJ ILODEFR if SEX == 1 [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl_m = y[3,2]
gen maj2_unempl_m = y[4,2]
gen maj3_unempl_m = y[5,2]
gen maj4_unempl_m = y[6,2]
gen maj5_unempl_m = y[7,2]
gen maj6_unempl_m = y[8,2]
gen maj7_unempl_m = y[9,2]
gen maj8_unempl_m = y[10,2]
gen maj9_unempl_m = y[11,2]


tab SC10LMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(yf)

matrix list yf

gen maj1_unempl_f = yf[3,2]
gen maj2_unempl_f = yf[4,2]
gen maj3_unempl_f = yf[5,2]
gen maj4_unempl_f = yf[6,2]
gen maj5_unempl_f = yf[7,2]
gen maj6_unempl_f = yf[8,2]
gen maj7_unempl_f = yf[9,2]
gen maj8_unempl_f = yf[10,2]
gen maj9_unempl_f = yf[11,2]



qui forval j = 1/9  {
gen maj`j'_active_m = maj`j'_empl_m + maj`j'_unempl_m
}

qui forval j = 1/9  {
gen maj`j'_active_f = maj`j'_empl_f + maj`j'_unempl_f
}


qui forval j = 1/9  {
gen maj`j'_our_m = maj`j'_unempl_m / maj`j'_active_m
}

qui forval j = 1/9  {
gen maj`j'_our_f = maj`j'_unempl_f / maj`j'_active_f
}

preserve
keep maj*_our* 

duplicates drop maj*, force
xpose , clear varname
rename v1 our_aprjun18
save "./our_aprjun18", replace
restore

preserve
keep maj*_empl_* maj*_unempl_*
duplicates drop maj*, force
xpose , clear varname
rename v1 obs_aprjun18
save "./obs_aprjun18", replace
restore


tab SC10MMN ILODEFR if SEX == 1  [aw=PWT18], matcell(x)

matrix list x

gen min111_empl_m = x[3,1]  
gen min112_empl_m = x[4,1]  
gen min113_empl_m = x[5,1]  
gen min115_empl_m = x[6,1]  
gen min116_empl_m = x[7,1]  
gen min117_empl_m = x[8,1]  
gen min118_empl_m = x[9,1]  
gen min119_empl_m = x[10,1]  
gen min121_empl_m = x[11,1]  
gen min122_empl_m = x[12,1]  
gen min124_empl_m = x[13,1]  
gen min125_empl_m = x[14,1]  
gen min211_empl_m = x[15,1]  
gen min212_empl_m = x[16,1]  
gen min213_empl_m = x[17,1]  
gen min214_empl_m = x[18,1]  
gen min215_empl_m = x[19,1]  
gen min221_empl_m = x[20,1]  
gen min222_empl_m = x[21,1]  
gen min223_empl_m = x[22,1]  
gen min231_empl_m = x[23,1]  
gen min241_empl_m = x[24,1]  
gen min242_empl_m = x[25,1]  
gen min243_empl_m = x[26,1]  
gen min244_empl_m = x[27,1]  
gen min245_empl_m = x[28,1]  
gen min246_empl_m = x[29,1]  
gen min247_empl_m = x[30,1]  
gen min311_empl_m = x[31,1]  
gen min312_empl_m = x[32,1]  
gen min313_empl_m = x[33,1]  
gen min321_empl_m = x[34,1]  
gen min323_empl_m = x[35,1]  
gen min331_empl_m = x[36,1]  
gen min341_empl_m = x[37,1]  
gen min342_empl_m = x[38,1]  
gen min344_empl_m = x[39,1]  
gen min351_empl_m = x[40,1]  
gen min352_empl_m = x[41,1]  
gen min353_empl_m = x[42,1]  
gen min354_empl_m = x[43,1]  
gen min355_empl_m = x[44,1]  
gen min356_empl_m = x[45,1]  
gen min411_empl_m = x[46,1]  
gen min412_empl_m = x[47,1]  
gen min413_empl_m = x[48,1]  
gen min415_empl_m = x[49,1]  
gen min416_empl_m = x[50,1]  
gen min421_empl_m = x[51,1]  
gen min511_empl_m = x[52,1]  
gen min521_empl_m = x[53,1]  
gen min522_empl_m = x[54,1]  
gen min523_empl_m = x[55,1]  
gen min524_empl_m = x[56,1]  
gen min525_empl_m = x[57,1]  
gen min531_empl_m = x[58,1]  
gen min532_empl_m = x[59,1]  
gen min533_empl_m = x[60,1]  
gen min541_empl_m = x[61,1]  
gen min542_empl_m = x[62,1]  
gen min543_empl_m = x[63,1]  
gen min544_empl_m = x[64,1]  
gen min612_empl_m = x[65,1]  
gen min613_empl_m = x[66,1]  
gen min614_empl_m = x[67,1]  
gen min621_empl_m = x[68,1]  
gen min622_empl_m = x[69,1]  
gen min623_empl_m = x[70,1]  
gen min624_empl_m = x[71,1]  
gen min711_empl_m = x[72,1]  
gen min712_empl_m = x[73,1]  
gen min713_empl_m = x[74,1]  
gen min721_empl_m = x[75,1]  
gen min722_empl_m = x[76,1]  
gen min811_empl_m = x[77,1]  
gen min812_empl_m = x[78,1]  
gen min813_empl_m = x[79,1]  
gen min814_empl_m = x[80,1]  
gen min821_empl_m = x[81,1]  
gen min822_empl_m = x[82,1]  
gen min823_empl_m = x[83,1]  
gen min911_empl_m = x[84,1]  
gen min912_empl_m = x[85,1]  
gen min913_empl_m = x[86,1]  
gen min921_empl_m = x[87,1]  
gen min923_empl_m = x[88,1]  
gen min924_empl_m = x[89,1]  
gen min925_empl_m = x[90,1]  
gen min926_empl_m = x[91,1]  
gen min927_empl_m = x[92,1]  


tab SC10MMN ILODEFR if SEX == 2  [aw=PWT18], matcell(xf)

matrix list xf

gen min111_empl_f = xf[3,1]  
gen min112_empl_f = xf[4,1]  
gen min113_empl_f = xf[5,1]  
gen min115_empl_f = xf[6,1]  
gen min116_empl_f = xf[7,1]  
gen min117_empl_f = xf[8,1]  
gen min118_empl_f = xf[9,1]  
gen min119_empl_f = xf[10,1]  
gen min121_empl_f = xf[11,1]  
gen min122_empl_f = xf[12,1]  
gen min124_empl_f = xf[13,1]  
gen min125_empl_f = xf[14,1]  
gen min211_empl_f = xf[15,1]  
gen min212_empl_f = xf[16,1]  
gen min213_empl_f = xf[17,1]  
gen min214_empl_f = xf[18,1]  
gen min215_empl_f = xf[19,1]  
gen min221_empl_f = xf[20,1]  
gen min222_empl_f = xf[21,1]  
gen min223_empl_f = xf[22,1]  
gen min231_empl_f = xf[23,1]  
gen min241_empl_f = xf[24,1]  
gen min242_empl_f = xf[25,1]  
gen min243_empl_f = xf[26,1]  
gen min244_empl_f = xf[27,1]  
gen min245_empl_f = xf[28,1]  
gen min246_empl_f = xf[29,1]  
gen min247_empl_f = xf[30,1]  
gen min311_empl_f = xf[31,1]  
gen min312_empl_f = xf[32,1]  
gen min313_empl_f = xf[33,1]  
gen min321_empl_f = xf[34,1]  
gen min323_empl_f = xf[35,1]  
gen min331_empl_f = xf[36,1]  
gen min341_empl_f = xf[37,1]  
gen min342_empl_f = xf[38,1]  
gen min344_empl_f = xf[39,1]  
gen min351_empl_f = xf[40,1]  
gen min352_empl_f = xf[41,1]  
gen min353_empl_f = xf[42,1]  
gen min354_empl_f = xf[43,1]  
gen min355_empl_f = xf[44,1]  
gen min356_empl_f = xf[45,1]  
gen min411_empl_f = xf[46,1]  
gen min412_empl_f = xf[47,1]  
gen min413_empl_f = xf[48,1]  
gen min415_empl_f = xf[49,1]  
gen min416_empl_f = xf[50,1]  
gen min421_empl_f = xf[51,1]  
gen min511_empl_f = xf[52,1]  
*gen min521_empl_f= xf[53,1]
gen min522_empl_f = xf[53,1]  
gen min523_empl_f = xf[54,1]  
gen min524_empl_f = xf[55,1]  
gen min525_empl_f = xf[56,1]  
gen min531_empl_f = xf[57,1]  
gen min532_empl_f = xf[58,1]  
gen min533_empl_f = xf[59,1]  
gen min541_empl_f = xf[60,1]  
gen min542_empl_f = xf[61,1]  
gen min543_empl_f = xf[62,1]  
gen min544_empl_f = xf[63,1]  
gen min612_empl_f = xf[64,1]  
gen min613_empl_f = xf[65,1]  
gen min614_empl_f = xf[66,1]  
gen min621_empl_f = xf[67,1]  
gen min622_empl_f = xf[68,1]  
gen min623_empl_f = xf[69,1]  
gen min624_empl_f = xf[70,1]  
gen min711_empl_f = xf[71,1]  
gen min712_empl_f = xf[72,1]  
gen min713_empl_f = xf[73,1]  
gen min721_empl_f = xf[74,1]  
gen min722_empl_f = xf[75,1]  
gen min811_empl_f = xf[76,1]  
gen min812_empl_f = xf[77,1]  
gen min813_empl_f = xf[78,1]  
gen min814_empl_f = xf[79,1]  
gen min821_empl_f = xf[80,1]  
gen min822_empl_f = xf[81,1]  
gen min823_empl_f = xf[82,1]  
gen min911_empl_f = xf[83,1]  
gen min912_empl_f = xf[84,1]  
gen min913_empl_f = xf[85,1]  
gen min921_empl_f = xf[86,1]  
gen min923_empl_f = xf[87,1]  
gen min924_empl_f = xf[88,1]  
gen min925_empl_f = xf[89,1]  
gen min926_empl_f = xf[90,1]  
gen min927_empl_f = xf[91,1]  


tab SC10LMN ILODEFR if SEX == 1  [aw=PWT18], matcell(y)

matrix list y

gen min111_unempl_m = y[3,2]  
gen min112_unempl_m = y[4,2]  
gen min113_unempl_m = y[5,2]  
gen min115_unempl_m = y[6,2]  
gen min116_unempl_m = y[7,2]  
gen min117_unempl_m = y[8,2]  
gen min118_unempl_m = y[9,2]  
gen min119_unempl_m = y[10,2]  
gen min121_unempl_m = y[11,2]  
gen min122_unempl_m = y[12,2]  
gen min125_unempl_m = y[13,2]  
gen min211_unempl_m = y[14,2]  
gen min212_unempl_m = y[15,2]  
gen min213_unempl_m = y[16,2]  
gen min214_unempl_m = y[17,2]  
gen min221_unempl_m = y[18,2]  
gen min222_unempl_m = y[19,2]  
gen min223_unempl_m = y[20,2]  
gen min231_unempl_m = y[21,2]  
gen min241_unempl_m = y[22,2]  
gen min242_unempl_m = y[23,2]  
gen min243_unempl_m = y[24,2]  
gen min244_unempl_m = y[25,2]  
gen min245_unempl_m = y[26,2]  
gen min246_unempl_m = y[27,2]  
gen min247_unempl_m = y[28,2]  
gen min311_unempl_m = y[29,2]  
gen min312_unempl_m = y[30,2]  
gen min313_unempl_m = y[31,2]  
gen min321_unempl_m = y[32,2]  
gen min323_unempl_m = y[33,2]  
gen min331_unempl_m = y[34,2]  
gen min341_unempl_m = y[35,2]  
gen min342_unempl_m = y[36,2]  
gen min344_unempl_m = y[37,2]  
gen min351_unempl_m = y[38,2]  
gen min352_unempl_m = y[39,2]  
gen min353_unempl_m = y[40,2]  
gen min354_unempl_m = y[41,2]  
gen min356_unempl_m = y[42,2]  
gen min411_unempl_m = y[43,2]  
gen min412_unempl_m = y[44,2]  
gen min413_unempl_m = y[45,2]  
gen min415_unempl_m = y[46,2]  
gen min416_unempl_m = y[47,2]  
gen min421_unempl_m = y[48,2]  
gen min511_unempl_m = y[49,2]  
gen min521_unempl_m = y[50,2]  
gen min522_unempl_m = y[51,2]  
gen min523_unempl_m = y[52,2]  
gen min524_unempl_m = y[53,2]  
gen min525_unempl_m = y[54,2]  
gen min531_unempl_m = y[55,2]  
gen min532_unempl_m = y[56,2]  
gen min533_unempl_m = y[57,2]  
gen min541_unempl_m = y[58,2]  
gen min542_unempl_m = y[59,2]  
gen min543_unempl_m = y[60,2]  
gen min544_unempl_m = y[61,2]  
gen min612_unempl_m = y[62,2]  
gen min613_unempl_m = y[63,2]  
gen min614_unempl_m = y[64,2]  
gen min621_unempl_m = y[65,2]  
gen min622_unempl_m = y[66,2]  
gen min623_unempl_m = y[67,2]  
gen min624_unempl_m = y[68,2]  
gen min711_unempl_m = y[69,2]  
gen min712_unempl_m = y[70,2]  
gen min713_unempl_m = y[71,2]  
gen min721_unempl_m = y[72,2]  
gen min722_unempl_m = y[73,2]  
gen min811_unempl_m = y[74,2]  
gen min812_unempl_m = y[75,2]  
gen min813_unempl_m = y[76,2]  
gen min814_unempl_m = y[77,2]  
gen min821_unempl_m = y[78,2]  
gen min822_unempl_m = y[79,2]  
gen min823_unempl_m = y[80,2]  
gen min911_unempl_m = y[81,2]  
gen min912_unempl_m = y[82,2]  
gen min913_unempl_m = y[83,2]  
gen min921_unempl_m = y[84,2]  
gen min923_unempl_m = y[85,2]  
gen min924_unempl_m = y[86,2]  
gen min925_unempl_m = y[87,2]  

tab SC10LMN ILODEFR if SEX == 2  [aw=PWT18], matcell(yf)

matrix list yf

gen min111_unempl_f = yf[3,2]  
gen min112_unempl_f = yf[4,2]  
gen min113_unempl_f = yf[5,2]  
gen min115_unempl_f = yf[6,2]  
gen min116_unempl_f = yf[7,2]  
gen min117_unempl_f = yf[8,2]  
gen min118_unempl_f = yf[9,2]  
gen min119_unempl_f = yf[10,2]  
gen min121_unempl_f = yf[11,2]  
gen min122_unempl_f = yf[12,2]  
gen min124_unempl_f = yf[13,2]  
gen min125_unempl_f = yf[14,2]  
gen min211_unempl_f = yf[15,2]  
gen min212_unempl_f = yf[16,2]  
gen min213_unempl_f = yf[17,2]  
gen min214_unempl_f = yf[18,2]  
gen min215_unempl_f = yf[19,2]  
gen min221_unempl_f = yf[20,2]  
gen min222_unempl_f = yf[21,2]  
gen min223_unempl_f = yf[22,2]  
gen min231_unempl_f = yf[23,2]  
gen min241_unempl_f = yf[24,2]  
gen min242_unempl_f = yf[25,2]  
gen min243_unempl_f = yf[26,2]  
gen min244_unempl_f = yf[27,2]  
gen min245_unempl_f = yf[28,2]  
gen min246_unempl_f = yf[29,2]  
gen min247_unempl_f = yf[30,2]  
gen min311_unempl_f = yf[31,2]  
gen min312_unempl_f = yf[32,2]  
gen min313_unempl_f = yf[33,2]  
gen min321_unempl_f = yf[34,2]  
gen min323_unempl_f = yf[35,2]  
gen min331_unempl_f = yf[36,2]  
gen min341_unempl_f = yf[37,2]  
gen min342_unempl_f = yf[38,2]  
gen min344_unempl_f = yf[39,2]  
gen min352_unempl_f = yf[40,2]  
gen min353_unempl_f = yf[41,2]  
gen min354_unempl_f = yf[42,2]  
gen min356_unempl_f = yf[43,2]  
gen min411_unempl_f = yf[44,2]  
gen min412_unempl_f = yf[45,2]  
gen min413_unempl_f = yf[46,2]  
gen min415_unempl_f = yf[47,2]  
gen min416_unempl_f = yf[48,2]  
gen min421_unempl_f = yf[49,2]  
gen min511_unempl_f = yf[50,2]  
gen min521_unempl_f = yf[51,2]  
gen min522_unempl_f = yf[52,2]  
gen min531_unempl_f = yf[53,2]  
gen min532_unempl_f = yf[54,2]  
gen min541_unempl_f = yf[55,2]  
gen min542_unempl_f = yf[56,2]  
gen min543_unempl_f = yf[57,2]  
gen min544_unempl_f = yf[58,2]  
gen min612_unempl_f = yf[59,2]  
gen min613_unempl_f = yf[60,2]  
gen min614_unempl_f = yf[61,2]  
gen min621_unempl_f = yf[62,2]  
gen min622_unempl_f = yf[63,2]  
gen min623_unempl_f = yf[64,2]  
gen min624_unempl_f = yf[65,2]  
gen min711_unempl_f = yf[66,2]  
gen min712_unempl_f = yf[67,2]  
gen min713_unempl_f = yf[68,2]  
gen min721_unempl_f = yf[69,2]  
gen min722_unempl_f = yf[70,2]  
gen min811_unempl_f = yf[71,2]  
gen min812_unempl_f = yf[72,2]  
gen min813_unempl_f = yf[73,2]  
gen min821_unempl_f = yf[74,2]  
gen min822_unempl_f = yf[75,2]  
gen min823_unempl_f = yf[76,2]  
gen min911_unempl_f = yf[77,2]  
gen min912_unempl_f = yf[78,2]  
gen min913_unempl_f = yf[79,2]  
gen min921_unempl_f = yf[80,2]  
gen min923_unempl_f = yf[81,2]  
gen min924_unempl_f = yf[82,2]  
gen min925_unempl_f = yf[83,2]  
gen min926_unempl_f = yf[84,2]  
gen min927_unempl_f = yf[85,2]  


qui foreach j in 111 112 113 115 116 117 118 119 121 122 125 211 212 213 214 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354   356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925  {
gen min`j'_active_m = min`j'_empl_m + min`j'_unempl_m
}


qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344  352 353 354  356 411 412 413 415 416 421 511 522 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active_f = min`j'_empl_f + min`j'_unempl_f
}


qui foreach j in  111 112 113 115 116 117 118 119 121 122 125 211 212 213 214 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354   356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925  {
gen min`j'_our_m = min`j'_unempl_m / min`j'_active_m
}

qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344  352 353 354  356 411 412 413 415 416 421 511 522 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 822 823 911 912 913 921 923 924 925 926 927   {
gen min`j'_our_f = min`j'_unempl_f / min`j'_active_f
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_aprjun18
save "./ourmin_aprjun18", replace
restore

preserve
keep min*_empl_* min*_unempl_*
duplicates drop min*, force
xpose , clear varname
rename v1 obs_aprjun18
save "./obsmin_aprjun18", replace
restore


use "UKDA-8485-stata/stata/stata13/lfsp_jm19_eul_pwt18", clear // Jan-Mar19

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 

tab SC10MMJ ILODEFR if SEX == 1 [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl_m = x[3,1]
gen maj2_empl_m = x[4,1]
gen maj3_empl_m = x[5,1]
gen maj4_empl_m = x[6,1]
gen maj5_empl_m = x[7,1]
gen maj6_empl_m = x[8,1]
gen maj7_empl_m = x[9,1]
gen maj8_empl_m = x[10,1]
gen maj9_empl_m = x[11,1]

tab SC10MMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(xf)

matrix list xf

gen maj1_empl_f = xf[3,1]
gen maj2_empl_f = xf[4,1]
gen maj3_empl_f = xf[5,1]
gen maj4_empl_f = xf[6,1]
gen maj5_empl_f = xf[7,1]
gen maj6_empl_f = xf[8,1]
gen maj7_empl_f = xf[9,1]
gen maj8_empl_f = xf[10,1]
gen maj9_empl_f = xf[11,1]


tab SC10LMJ ILODEFR if SEX == 1 [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl_m = y[3,2]
gen maj2_unempl_m = y[4,2]
gen maj3_unempl_m = y[5,2]
gen maj4_unempl_m = y[6,2]
gen maj5_unempl_m = y[7,2]
gen maj6_unempl_m = y[8,2]
gen maj7_unempl_m = y[9,2]
gen maj8_unempl_m = y[10,2]
gen maj9_unempl_m = y[11,2]


tab SC10LMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(yf)

matrix list yf

gen maj1_unempl_f = yf[3,2]
gen maj2_unempl_f = yf[4,2]
gen maj3_unempl_f = yf[5,2]
gen maj4_unempl_f = yf[6,2]
gen maj5_unempl_f = yf[7,2]
gen maj6_unempl_f = yf[8,2]
gen maj7_unempl_f = yf[9,2]
gen maj8_unempl_f = yf[10,2]
gen maj9_unempl_f = yf[11,2]



qui forval j = 1/9  {
gen maj`j'_active_m = maj`j'_empl_m + maj`j'_unempl_m
}

qui forval j = 1/9  {
gen maj`j'_active_f = maj`j'_empl_f + maj`j'_unempl_f
}


qui forval j = 1/9  {
gen maj`j'_our_m = maj`j'_unempl_m / maj`j'_active_m
}

qui forval j = 1/9  {
gen maj`j'_our_f = maj`j'_unempl_f / maj`j'_active_f
}


preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_janmar19
save "./our_janmar19", replace
restore

preserve
keep maj*_empl_* maj*_unempl_*
duplicates drop maj*, force
xpose , clear varname
rename v1 obs_janmar19
save "./obs_janmar19", replace
restore

tab SC10MMN ILODEFR if SEX == 1  [aw=PWT18], matcell(x)

matrix list x

gen min111_empl_m = x[3,1]  
gen min112_empl_m = x[4,1]  
gen min113_empl_m = x[5,1]  
gen min115_empl_m = x[6,1]  
gen min116_empl_m = x[7,1]  
gen min117_empl_m = x[8,1]  
gen min118_empl_m = x[9,1]  
gen min119_empl_m = x[10,1]  
gen min121_empl_m = x[11,1]  
gen min122_empl_m = x[12,1]  
gen min124_empl_m = x[13,1]  
gen min125_empl_m = x[14,1]  
gen min211_empl_m = x[15,1]  
gen min212_empl_m = x[16,1]  
gen min213_empl_m = x[17,1]  
gen min214_empl_m = x[18,1]  
gen min215_empl_m = x[19,1]  
gen min221_empl_m = x[20,1]  
gen min222_empl_m = x[21,1]  
gen min223_empl_m = x[22,1]  
gen min231_empl_m = x[23,1]  
gen min241_empl_m = x[24,1]  
gen min242_empl_m = x[25,1]  
gen min243_empl_m = x[26,1]  
gen min244_empl_m = x[27,1]  
gen min245_empl_m = x[28,1]  
gen min246_empl_m = x[29,1]  
gen min247_empl_m = x[30,1]  
gen min311_empl_m = x[31,1]  
gen min312_empl_m = x[32,1]  
gen min313_empl_m = x[33,1]  
gen min321_empl_m = x[34,1]  
gen min323_empl_m = x[35,1]  
gen min331_empl_m = x[36,1]  
gen min341_empl_m = x[37,1]  
gen min342_empl_m = x[38,1]  
gen min344_empl_m = x[39,1]  
gen min351_empl_m = x[40,1]  
gen min352_empl_m = x[41,1]  
gen min353_empl_m = x[42,1]  
gen min354_empl_m = x[43,1]  
gen min355_empl_m = x[44,1]  
gen min356_empl_m = x[45,1]  
gen min411_empl_m = x[46,1]  
gen min412_empl_m = x[47,1]  
gen min413_empl_m = x[48,1]  
gen min415_empl_m = x[49,1]  
gen min416_empl_m = x[50,1]  
gen min421_empl_m = x[51,1]  
gen min511_empl_m = x[52,1]  
gen min521_empl_m = x[53,1]  
gen min522_empl_m = x[54,1]  
gen min523_empl_m = x[55,1]  
gen min524_empl_m = x[56,1]  
gen min525_empl_m = x[57,1]  
gen min531_empl_m = x[58,1]  
gen min532_empl_m = x[59,1]  
gen min533_empl_m = x[60,1]  
gen min541_empl_m = x[61,1]  
gen min542_empl_m = x[62,1]  
gen min543_empl_m = x[63,1]  
gen min544_empl_m = x[64,1]  
gen min612_empl_m = x[65,1]  
gen min613_empl_m = x[66,1]  
gen min614_empl_m = x[67,1]  
gen min621_empl_m = x[68,1]  
gen min622_empl_m = x[69,1]  
gen min623_empl_m = x[70,1]  
gen min624_empl_m = x[71,1]  
gen min711_empl_m = x[72,1]  
gen min712_empl_m = x[73,1]  
gen min713_empl_m = x[74,1]  
gen min721_empl_m = x[75,1]  
gen min722_empl_m = x[76,1]  
gen min811_empl_m = x[77,1]  
gen min812_empl_m = x[78,1]  
gen min813_empl_m = x[79,1]  
gen min814_empl_m = x[80,1]  
gen min821_empl_m = x[81,1]  
gen min822_empl_m = x[82,1]  
gen min823_empl_m = x[83,1]  
gen min911_empl_m = x[84,1]  
gen min912_empl_m = x[85,1]  
gen min913_empl_m = x[86,1]  
gen min921_empl_m = x[87,1]  
gen min923_empl_m = x[88,1]  
gen min924_empl_m = x[89,1]  
gen min925_empl_m = x[90,1]  
gen min926_empl_m = x[91,1]  
gen min927_empl_m = x[92,1]  

tab SC10MMN ILODEFR if SEX == 2  [aw=PWT18], matcell(xf)

matrix list xf

gen min111_empl_f = xf[3,1]  
gen min112_empl_f = xf[4,1]  
gen min113_empl_f = xf[5,1]  
gen min115_empl_f = xf[6,1]  
gen min116_empl_f = xf[7,1]  
gen min117_empl_f = xf[8,1]  
gen min118_empl_f = xf[9,1]  
gen min119_empl_f = xf[10,1]  
gen min121_empl_f = xf[11,1]  
gen min122_empl_f = xf[12,1]  
gen min124_empl_f = xf[13,1]  
gen min125_empl_f = xf[14,1]  
gen min211_empl_f = xf[15,1]  
gen min212_empl_f = xf[16,1]  
gen min213_empl_f = xf[17,1]  
gen min214_empl_f = xf[18,1]  
gen min215_empl_f = xf[19,1]  
gen min221_empl_f = xf[20,1]  
gen min222_empl_f = xf[21,1]  
gen min223_empl_f = xf[22,1]  
gen min231_empl_f = xf[23,1]  
gen min241_empl_f = xf[24,1]  
gen min242_empl_f = xf[25,1]  
gen min243_empl_f = xf[26,1]  
gen min244_empl_f = xf[27,1]  
gen min245_empl_f = xf[28,1]  
gen min246_empl_f = xf[29,1]  
gen min247_empl_f = xf[30,1]  
gen min311_empl_f = xf[31,1]  
gen min312_empl_f = xf[32,1]  
gen min313_empl_f = xf[33,1]  
gen min321_empl_f = xf[34,1]  
gen min323_empl_f = xf[35,1]  
gen min331_empl_f = xf[36,1]  
gen min341_empl_f = xf[37,1]  
gen min342_empl_f = xf[38,1]  
gen min344_empl_f = xf[39,1]  
gen min351_empl_f = xf[40,1]  
gen min352_empl_f = xf[41,1]  
gen min353_empl_f = xf[42,1]  
gen min354_empl_f = xf[43,1]  
gen min355_empl_f = xf[44,1]  
gen min356_empl_f = xf[45,1]  
gen min411_empl_f = xf[46,1]  
gen min412_empl_f = xf[47,1]  
gen min413_empl_f = xf[48,1]  
gen min415_empl_f = xf[49,1]  
gen min416_empl_f = xf[50,1]  
gen min421_empl_f = xf[51,1]  
gen min511_empl_f = xf[52,1]  
gen min521_empl_f = xf[53,1]  
gen min522_empl_f = xf[54,1]  
gen min523_empl_f = xf[55,1]  
gen min524_empl_f = xf[56,1]  
gen min525_empl_f = xf[57,1]  
gen min531_empl_f = xf[58,1]  
gen min532_empl_f = xf[59,1]  
gen min541_empl_f = xf[60,1]  
gen min542_empl_f = xf[61,1]  
gen min543_empl_f = xf[62,1]  
gen min544_empl_f = xf[63,1]  
gen min612_empl_f = xf[64,1]  
gen min613_empl_f = xf[65,1]  
gen min614_empl_f = xf[66,1]  
gen min621_empl_f = xf[67,1]  
gen min622_empl_f = xf[68,1]  
gen min623_empl_f = xf[69,1]  
gen min624_empl_f = xf[70,1]  
gen min711_empl_f = xf[71,1]  
gen min712_empl_f = xf[72,1]  
gen min713_empl_f = xf[73,1]  
gen min721_empl_f = xf[74,1]  
gen min722_empl_f = xf[75,1]  
gen min811_empl_f = xf[76,1]  
gen min812_empl_f = xf[77,1]  
gen min813_empl_f = xf[78,1]  
gen min814_empl_f = xf[79,1]  
gen min821_empl_f = xf[80,1]  
gen min822_empl_f = xf[81,1]  
gen min823_empl_f = xf[82,1]  
gen min911_empl_f = xf[83,1]  
gen min912_empl_f = xf[84,1]  
gen min913_empl_f = xf[85,1]  
gen min921_empl_f = xf[86,1]  
gen min923_empl_f = xf[87,1]  
gen min924_empl_f = xf[88,1]  
gen min925_empl_f = xf[89,1]  
gen min926_empl_f = xf[90,1]  
gen min927_empl_f = xf[91,1]  

tab SC10LMN ILODEFR if SEX == 1  [aw=PWT18], matcell(y)

matrix list y

gen min111_unempl_m = y[3,2]  
gen min112_unempl_m = y[4,2]  
gen min113_unempl_m = y[5,2]  
gen min115_unempl_m = y[6,2]  
gen min116_unempl_m = y[7,2]  
gen min117_unempl_m = y[8,2]  
gen min118_unempl_m = y[9,2]  
gen min119_unempl_m = y[10,2]  
gen min121_unempl_m = y[11,2]  
gen min122_unempl_m = y[12,2]  
gen min124_unempl_m = y[13,2]  
gen min125_unempl_m = y[14,2]  
gen min211_unempl_m = y[15,2]  
gen min212_unempl_m = y[16,2]  
gen min213_unempl_m = y[17,2]  
gen min214_unempl_m = y[18,2]  
gen min215_unempl_m = y[19,2]  
gen min221_unempl_m = y[20,2]  
gen min222_unempl_m = y[21,2]  
gen min223_unempl_m = y[22,2]  
gen min231_unempl_m = y[23,2]  
gen min241_unempl_m = y[24,2]  
gen min242_unempl_m = y[25,2]  
gen min243_unempl_m = y[26,2]  
gen min244_unempl_m = y[27,2]  
gen min245_unempl_m = y[28,2]  
gen min246_unempl_m = y[29,2]  
gen min247_unempl_m = y[30,2]  
gen min311_unempl_m = y[31,2]  
gen min312_unempl_m = y[32,2]  
gen min313_unempl_m = y[33,2]  
gen min321_unempl_m = y[34,2]  
gen min323_unempl_m = y[35,2]  
gen min331_unempl_m = y[36,2]  
gen min341_unempl_m = y[37,2]  
gen min342_unempl_m = y[38,2]  
gen min344_unempl_m = y[39,2]  
gen min351_unempl_m = y[40,2]  
gen min352_unempl_m = y[41,2]  
gen min353_unempl_m = y[42,2]  
gen min354_unempl_m = y[43,2]  
gen min356_unempl_m = y[44,2]  
gen min411_unempl_m = y[45,2]  
gen min412_unempl_m = y[46,2]  
gen min413_unempl_m = y[47,2]  
gen min415_unempl_m = y[48,2]  
gen min416_unempl_m = y[49,2]  
gen min421_unempl_m = y[50,2]  
gen min511_unempl_m = y[51,2]  
gen min521_unempl_m = y[52,2]  
gen min522_unempl_m = y[53,2]  
gen min523_unempl_m = y[54,2]  
gen min524_unempl_m = y[55,2]  
gen min525_unempl_m = y[56,2]  
gen min531_unempl_m = y[57,2]  
gen min532_unempl_m = y[58,2]  
gen min533_unempl_m = y[59,2]  
gen min541_unempl_m = y[60,2]  
gen min542_unempl_m = y[61,2]  
gen min543_unempl_m = y[62,2]  
gen min544_unempl_m = y[63,2]  
gen min612_unempl_m = y[64,2]  
gen min613_unempl_m = y[65,2]  
gen min614_unempl_m = y[66,2]  
gen min621_unempl_m = y[67,2]  
gen min622_unempl_m = y[68,2]  
gen min623_unempl_m = y[69,2]  
gen min624_unempl_m = y[70,2]  
gen min711_unempl_m = y[71,2]  
gen min712_unempl_m = y[72,2]  
gen min713_unempl_m = y[73,2]  
gen min721_unempl_m = y[74,2]  
gen min722_unempl_m = y[75,2]  
gen min811_unempl_m = y[76,2]  
gen min812_unempl_m = y[77,2]  
gen min813_unempl_m = y[78,2]  
gen min814_unempl_m = y[79,2]  
gen min821_unempl_m = y[80,2]  
gen min822_unempl_m = y[81,2]  
gen min823_unempl_m = y[82,2]  
gen min911_unempl_m = y[83,2]  
gen min912_unempl_m = y[84,2]  
gen min913_unempl_m = y[85,2]  
gen min921_unempl_m = y[86,2]  
gen min923_unempl_m = y[87,2]  
gen min924_unempl_m = y[88,2]  
gen min925_unempl_m = y[89,2]  
gen min926_unempl_m = y[90,2]  
gen min927_unempl_m = y[91,2]  


tab SC10LMN ILODEFR if SEX == 2  [aw=PWT18], matcell(yf)

matrix list yf

gen min111_unempl_f = yf[3,2]  
gen min112_unempl_f = yf[4,2]  
gen min113_unempl_f = yf[5,2]  
gen min115_unempl_f = yf[6,2]  
gen min116_unempl_f = yf[7,2]  
gen min117_unempl_f = yf[8,2]  
gen min118_unempl_f = yf[9,2]  
gen min119_unempl_f = yf[10,2]  
gen min122_unempl_f = yf[11,2]  
gen min124_unempl_f = yf[12,2]  
gen min125_unempl_f = yf[13,2]  
gen min211_unempl_f = yf[14,2]  
gen min212_unempl_f = yf[15,2]  
gen min213_unempl_f = yf[16,2]  
gen min214_unempl_f = yf[17,2]  
gen min215_unempl_f = yf[18,2]  
gen min221_unempl_f = yf[19,2]  
gen min222_unempl_f = yf[20,2]  
gen min223_unempl_f = yf[21,2]  
gen min231_unempl_f = yf[22,2]  
gen min241_unempl_f = yf[23,2]  
gen min242_unempl_f = yf[24,2]  
gen min243_unempl_f = yf[25,2]  
gen min244_unempl_f = yf[26,2]  
gen min245_unempl_f = yf[27,2]  
gen min246_unempl_f = yf[28,2]  
gen min247_unempl_f = yf[29,2]  
gen min311_unempl_f = yf[30,2]  
gen min312_unempl_f = yf[31,2]  
gen min313_unempl_f = yf[32,2]  
gen min321_unempl_f = yf[33,2]  
gen min323_unempl_f = yf[34,2]  
gen min331_unempl_f = yf[35,2]  
gen min341_unempl_f = yf[36,2]  
gen min342_unempl_f = yf[37,2]  
gen min344_unempl_f = yf[38,2]  
gen min352_unempl_f = yf[39,2]  
gen min353_unempl_f = yf[40,2]  
gen min354_unempl_f = yf[41,2]  
gen min355_unempl_f = yf[42,2]  
gen min356_unempl_f = yf[43,2]  
gen min411_unempl_f = yf[44,2]  
gen min412_unempl_f = yf[45,2]  
gen min413_unempl_f = yf[46,2]  
gen min415_unempl_f = yf[47,2]  
gen min416_unempl_f = yf[48,2]  
gen min421_unempl_f = yf[49,2]  
gen min511_unempl_f = yf[50,2]  
gen min521_unempl_f = yf[51,2]  
gen min522_unempl_f = yf[52,2]  
gen min524_unempl_f = yf[53,2]  
gen min531_unempl_f = yf[54,2]  
gen min532_unempl_f = yf[55,2]  
gen min533_unempl_f = yf[56,2]  
gen min541_unempl_f = yf[57,2]  
gen min542_unempl_f = yf[58,2]  
gen min543_unempl_f = yf[59,2]  
gen min544_unempl_f = yf[60,2]  
gen min612_unempl_f = yf[61,2]  
gen min613_unempl_f = yf[62,2]  
gen min614_unempl_f = yf[63,2]  
gen min621_unempl_f = yf[64,2]  
gen min622_unempl_f = yf[65,2]  
gen min623_unempl_f = yf[66,2]  
gen min624_unempl_f = yf[67,2]  
gen min711_unempl_f = yf[68,2]  
gen min712_unempl_f = yf[69,2]  
gen min713_unempl_f = yf[70,2]  
gen min721_unempl_f = yf[71,2]  
gen min722_unempl_f = yf[72,2]  
gen min811_unempl_f = yf[73,2]  
gen min812_unempl_f = yf[74,2]  
gen min813_unempl_f = yf[75,2]  
gen min821_unempl_f = yf[76,2]  
gen min823_unempl_f = yf[77,2]  
gen min911_unempl_f = yf[78,2]  
gen min912_unempl_f = yf[79,2]  
gen min913_unempl_f = yf[80,2]  
gen min921_unempl_f = yf[81,2]  
gen min923_unempl_f = yf[82,2]  
gen min924_unempl_f = yf[83,2]  
gen min925_unempl_f = yf[84,2]  
gen min926_unempl_f = yf[85,2]  
gen min927_unempl_f = yf[86,2] 


qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active_m = min`j'_empl_m + min`j'_unempl_m
}



qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 355 356 411 412 413 415 416 421 511 521 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 823 911 912 913 921 923 924 925 926 927   {
gen min`j'_active_f = min`j'_empl_f + min`j'_unempl_f
}


qui foreach j in  111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our_m = min`j'_unempl_m / min`j'_active_m
}

qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 355 356 411 412 413 415 416 421 511 521 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 823 911 912 913 921 923 924 925 926 927   {
gen min`j'_our_f = min`j'_unempl_f / min`j'_active_f
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_janmar19
save "./ourmin_janmar19", replace
restore

preserve
keep min*_empl_* min*_unempl_*
duplicates drop min*, force
xpose , clear varname
rename v1 obs_janmar19
save "./obsmin_janmar19", replace
restore



use "UKDA-8614-stata/stata/stata13/lfsp_od19_eul", clear // Oct-Dec19

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 

tab SC10MMJ ILODEFR if SEX == 1 [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl_m = x[3,1]
gen maj2_empl_m = x[4,1]
gen maj3_empl_m = x[5,1]
gen maj4_empl_m = x[6,1]
gen maj5_empl_m = x[7,1]
gen maj6_empl_m = x[8,1]
gen maj7_empl_m = x[9,1]
gen maj8_empl_m = x[10,1]
gen maj9_empl_m = x[11,1]

tab SC10MMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(xf)

matrix list xf

gen maj1_empl_f = xf[3,1]
gen maj2_empl_f = xf[4,1]
gen maj3_empl_f = xf[5,1]
gen maj4_empl_f = xf[6,1]
gen maj5_empl_f = xf[7,1]
gen maj6_empl_f = xf[8,1]
gen maj7_empl_f = xf[9,1]
gen maj8_empl_f = xf[10,1]
gen maj9_empl_f = xf[11,1]


tab SC10LMJ ILODEFR if SEX == 1 [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl_m = y[3,2]
gen maj2_unempl_m = y[4,2]
gen maj3_unempl_m = y[5,2]
gen maj4_unempl_m = y[6,2]
gen maj5_unempl_m = y[7,2]
gen maj6_unempl_m = y[8,2]
gen maj7_unempl_m = y[9,2]
gen maj8_unempl_m = y[10,2]
gen maj9_unempl_m = y[11,2]


tab SC10LMJ ILODEFR if SEX == 2 [aw=PWT18], matcell(yf)

matrix list yf

gen maj1_unempl_f = yf[3,2]
gen maj2_unempl_f = yf[4,2]
gen maj3_unempl_f = yf[5,2]
gen maj4_unempl_f = yf[6,2]
gen maj5_unempl_f = yf[7,2]
gen maj6_unempl_f = yf[8,2]
gen maj7_unempl_f = yf[9,2]
gen maj8_unempl_f = yf[10,2]
gen maj9_unempl_f = yf[11,2]



qui forval j = 1/9  {
gen maj`j'_active_m = maj`j'_empl_m + maj`j'_unempl_m
}

qui forval j = 1/9  {
gen maj`j'_active_f = maj`j'_empl_f + maj`j'_unempl_f
}


qui forval j = 1/9  {
gen maj`j'_our_m = maj`j'_unempl_m / maj`j'_active_m
}

qui forval j = 1/9  {
gen maj`j'_our_f = maj`j'_unempl_f / maj`j'_active_f
}

preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_octdec19
save "./our_octdec19", replace
restore

preserve
keep maj*_empl_* maj*_unempl_*
duplicates drop maj*, force
xpose , clear varname
rename v1 obs_octdec19
save "./obs_octdec19", replace
restore

tab SC10MMN ILODEFR if SEX == 1  [aw=PWT18], matcell(x)

matrix list x

gen min111_empl_m = x[3,1]  
gen min112_empl_m = x[4,1]  
gen min113_empl_m = x[5,1]  
gen min115_empl_m = x[6,1]  
gen min116_empl_m = x[7,1]  
gen min117_empl_m = x[8,1]  
gen min118_empl_m = x[9,1]  
gen min119_empl_m = x[10,1]  
gen min121_empl_m = x[11,1]  
gen min122_empl_m = x[12,1]  
gen min124_empl_m = x[13,1]  
gen min125_empl_m = x[14,1]  
gen min211_empl_m = x[15,1]  
gen min212_empl_m = x[16,1]  
gen min213_empl_m = x[17,1]  
gen min214_empl_m = x[18,1]  
gen min215_empl_m = x[19,1]  
gen min221_empl_m = x[20,1]  
gen min222_empl_m = x[21,1]  
gen min223_empl_m = x[22,1]  
gen min231_empl_m = x[23,1]  
gen min241_empl_m = x[24,1]  
gen min242_empl_m = x[25,1]  
gen min243_empl_m = x[26,1]  
gen min244_empl_m = x[27,1]  
gen min245_empl_m = x[28,1]  
gen min246_empl_m = x[29,1]  
gen min247_empl_m = x[30,1]  
gen min311_empl_m = x[31,1]  
gen min312_empl_m = x[32,1]  
gen min313_empl_m = x[33,1]  
gen min321_empl_m = x[34,1]  
gen min323_empl_m = x[35,1]  
gen min331_empl_m = x[36,1]  
gen min341_empl_m = x[37,1]  
gen min342_empl_m = x[38,1]  
gen min344_empl_m = x[39,1]  
gen min351_empl_m = x[40,1]  
gen min352_empl_m = x[41,1]  
gen min353_empl_m = x[42,1]  
gen min354_empl_m = x[43,1]  
gen min355_empl_m = x[44,1]  
gen min356_empl_m = x[45,1]  
gen min411_empl_m = x[46,1]  
gen min412_empl_m = x[47,1]  
gen min413_empl_m = x[48,1]  
gen min415_empl_m = x[49,1]  
gen min416_empl_m = x[50,1]  
gen min421_empl_m = x[51,1]  
gen min511_empl_m = x[52,1]  
gen min521_empl_m = x[53,1]  
gen min522_empl_m = x[54,1]  
gen min523_empl_m = x[55,1]  
gen min524_empl_m = x[56,1]  
gen min525_empl_m = x[57,1]  
gen min531_empl_m = x[58,1]  
gen min532_empl_m = x[59,1]  
gen min533_empl_m = x[60,1]  
gen min541_empl_m = x[61,1]  
gen min542_empl_m = x[62,1]  
gen min543_empl_m = x[63,1]  
gen min544_empl_m = x[64,1]  
gen min612_empl_m = x[65,1]  
gen min613_empl_m = x[66,1]  
gen min614_empl_m = x[67,1]  
gen min621_empl_m = x[68,1]  
gen min622_empl_m = x[69,1]  
gen min623_empl_m = x[70,1]  
gen min624_empl_m = x[71,1]  
gen min711_empl_m = x[72,1]  
gen min712_empl_m = x[73,1]  
gen min713_empl_m = x[74,1]  
gen min721_empl_m = x[75,1]  
gen min722_empl_m = x[76,1]  
gen min811_empl_m = x[77,1]  
gen min812_empl_m = x[78,1]  
gen min813_empl_m = x[79,1]  
gen min814_empl_m = x[80,1]  
gen min821_empl_m = x[81,1]  
gen min822_empl_m = x[82,1]  
gen min823_empl_m = x[83,1]  
gen min911_empl_m = x[84,1]  
gen min912_empl_m = x[85,1]  
gen min913_empl_m = x[86,1]  
gen min921_empl_m = x[87,1]  
gen min923_empl_m = x[88,1]  
gen min924_empl_m = x[89,1]  
gen min925_empl_m = x[90,1]  
gen min926_empl_m = x[91,1]  
gen min927_empl_m = x[92,1]  

tab SC10MMN ILODEFR if SEX == 2  [aw=PWT18], matcell(xf)

matrix list xf

gen min111_empl_f = xf[3,1]  
gen min112_empl_f = xf[4,1]  
gen min113_empl_f = xf[5,1]  
gen min115_empl_f = xf[6,1]  
gen min116_empl_f = xf[7,1]  
gen min117_empl_f = xf[8,1]  
gen min118_empl_f = xf[9,1]  
gen min119_empl_f = xf[10,1]  
gen min121_empl_f = xf[11,1]  
gen min122_empl_f = xf[12,1]  
gen min124_empl_f = xf[13,1]  
gen min125_empl_f = xf[14,1]  
gen min211_empl_f = xf[15,1]  
gen min212_empl_f = xf[16,1]  
gen min213_empl_f = xf[17,1]  
gen min214_empl_f = xf[18,1]  
gen min215_empl_f = xf[19,1]  
gen min221_empl_f = xf[20,1]  
gen min222_empl_f = xf[21,1]  
gen min223_empl_f = xf[22,1]  
gen min231_empl_f = xf[23,1]  
gen min241_empl_f = xf[24,1]  
gen min242_empl_f = xf[25,1]  
gen min243_empl_f = xf[26,1]  
gen min244_empl_f = xf[27,1]  
gen min245_empl_f = xf[28,1]  
gen min246_empl_f = xf[29,1]  
gen min247_empl_f = xf[30,1]  
gen min311_empl_f = xf[31,1]  
gen min312_empl_f = xf[32,1]  
gen min313_empl_f = xf[33,1]  
gen min321_empl_f = xf[34,1]  
gen min323_empl_f = xf[35,1]  
gen min331_empl_f = xf[36,1]  
gen min341_empl_f = xf[37,1]  
gen min342_empl_f = xf[38,1]  
gen min344_empl_f = xf[39,1]  
gen min351_empl_f = xf[40,1]  
gen min352_empl_f = xf[41,1]  
gen min353_empl_f = xf[42,1]  
gen min354_empl_f = xf[43,1]  
gen min355_empl_f = xf[44,1]  
gen min356_empl_f = xf[45,1]  
gen min411_empl_f = xf[46,1]  
gen min412_empl_f = xf[47,1]  
gen min413_empl_f = xf[48,1]  
gen min415_empl_f = xf[49,1]  
gen min416_empl_f = xf[50,1]  
gen min421_empl_f = xf[51,1]  
gen min511_empl_f = xf[52,1]  
gen min521_empl_f = xf[53,1]  
gen min522_empl_f = xf[54,1]  
gen min523_empl_f = xf[55,1]  
gen min524_empl_f = xf[56,1]  
gen min525_empl_f = xf[57,1]  
gen min531_empl_f = xf[58,1]  
gen min532_empl_f = xf[59,1]  
gen min533_empl_f = xf[60,1]  
gen min541_empl_f = xf[61,1]  
gen min542_empl_f = xf[62,1]  
gen min543_empl_f = xf[63,1]  
gen min544_empl_f = xf[64,1]  
gen min612_empl_f = xf[65,1]  
gen min613_empl_f = xf[66,1]  
gen min614_empl_f = xf[67,1]  
gen min621_empl_f = xf[68,1]  
gen min622_empl_f = xf[69,1]  
gen min623_empl_f = xf[70,1]  
gen min624_empl_f = xf[71,1]  
gen min711_empl_f = xf[72,1]  
gen min712_empl_f = xf[73,1]  
gen min713_empl_f = xf[74,1]  
gen min721_empl_f = xf[75,1]  
gen min722_empl_f = xf[76,1]  
gen min811_empl_f = xf[77,1]  
gen min812_empl_f = xf[78,1]  
gen min813_empl_f = xf[79,1]  
gen min814_empl_f = xf[80,1]  
gen min821_empl_f = xf[81,1]  
gen min823_empl_f = xf[82,1]  
gen min911_empl_f = xf[83,1]  
gen min912_empl_f = xf[84,1]  
gen min913_empl_f = xf[85,1]  
gen min921_empl_f = xf[86,1]  
gen min923_empl_f = xf[87,1]  
gen min924_empl_f = xf[88,1]  
gen min925_empl_f = xf[89,1]  
gen min926_empl_f = xf[90,1]  
gen min927_empl_f = xf[91,1] 

tab SC10LMN ILODEFR if SEX == 1  [aw=PWT18], matcell(y)

matrix list y

gen min111_unempl_m = y[3,2]   
gen min112_unempl_m = y[4,2]   
gen min113_unempl_m = y[5,2]   
gen min115_unempl_m = y[6,2]   
gen min116_unempl_m = y[7,2]   
gen min117_unempl_m = y[8,2]   
gen min118_unempl_m = y[9,2]   
gen min119_unempl_m = y[10,2]   
gen min121_unempl_m = y[11,2]   
gen min122_unempl_m = y[12,2]   
gen min124_unempl_m = y[13,2]   
gen min125_unempl_m = y[14,2]   
gen min211_unempl_m = y[15,2]   
gen min212_unempl_m = y[16,2]   
gen min213_unempl_m = y[17,2]   
gen min214_unempl_m = y[18,2]   
gen min215_unempl_m = y[19,2]   
gen min221_unempl_m = y[20,2]   
gen min222_unempl_m = y[21,2]   
gen min223_unempl_m = y[22,2]   
gen min231_unempl_m = y[23,2]   
gen min241_unempl_m = y[24,2]   
gen min242_unempl_m = y[25,2]   
gen min243_unempl_m = y[26,2]   
gen min244_unempl_m = y[27,2]   
gen min245_unempl_m = y[28,2]   
gen min246_unempl_m = y[29,2]   
gen min247_unempl_m = y[30,2]   
gen min311_unempl_m = y[31,2]   
gen min312_unempl_m = y[32,2]   
gen min313_unempl_m = y[33,2]   
gen min321_unempl_m = y[34,2]   
gen min323_unempl_m = y[35,2]   
gen min331_unempl_m = y[36,2]   
gen min341_unempl_m = y[37,2]   
gen min342_unempl_m = y[38,2]   
gen min344_unempl_m = y[39,2]   
gen min351_unempl_m = y[40,2]   
gen min352_unempl_m = y[41,2]   
gen min353_unempl_m = y[42,2]   
gen min354_unempl_m = y[43,2]   
gen min355_unempl_m = y[44,2]   
gen min356_unempl_m = y[45,2]   
gen min411_unempl_m = y[46,2]   
gen min412_unempl_m = y[47,2]   
gen min413_unempl_m = y[48,2]   
gen min415_unempl_m = y[49,2]   
gen min416_unempl_m = y[50,2]   
gen min421_unempl_m = y[51,2]   
gen min511_unempl_m = y[52,2]   
gen min521_unempl_m = y[53,2]   
gen min522_unempl_m = y[54,2]   
gen min523_unempl_m = y[55,2]   
gen min524_unempl_m = y[56,2]   
gen min525_unempl_m = y[57,2]   
gen min531_unempl_m = y[58,2]   
gen min532_unempl_m = y[59,2]   
gen min533_unempl_m = y[60,2]   
gen min541_unempl_m = y[61,2]   
gen min542_unempl_m = y[62,2]   
gen min543_unempl_m = y[63,2]   
gen min544_unempl_m = y[64,2]   
gen min612_unempl_m = y[65,2]   
gen min613_unempl_m = y[66,2]   
gen min614_unempl_m = y[67,2]   
gen min621_unempl_m = y[68,2]   
gen min622_unempl_m = y[69,2]   
gen min623_unempl_m = y[70,2]   
gen min624_unempl_m = y[71,2]   
gen min711_unempl_m = y[72,2]   
gen min712_unempl_m = y[73,2]   
gen min713_unempl_m = y[74,2]   
gen min721_unempl_m = y[75,2]   
gen min722_unempl_m = y[76,2]   
gen min811_unempl_m = y[77,2]   
gen min812_unempl_m = y[78,2]   
gen min813_unempl_m = y[79,2]   
gen min814_unempl_m = y[80,2]   
gen min821_unempl_m = y[81,2]   
gen min822_unempl_m = y[82,2]   
gen min823_unempl_m = y[83,2]   
gen min911_unempl_m = y[84,2]   
gen min912_unempl_m = y[85,2]   
gen min913_unempl_m = y[86,2]   
gen min921_unempl_m = y[87,2]   
gen min923_unempl_m = y[88,2]   
gen min924_unempl_m = y[89,2]   
gen min925_unempl_m = y[90,2]   
gen min926_unempl_m = y[91,2]   
gen min927_unempl_m = y[92,2]  

tab SC10LMN ILODEFR if SEX == 2  [aw=PWT18], matcell(yf)

matrix list yf

gen min111_unempl_f = yf[3,2]  
gen min112_unempl_f = yf[4,2]  
gen min113_unempl_f = yf[5,2]  
gen min115_unempl_f = yf[6,2]  
gen min116_unempl_f = yf[7,2]  
gen min117_unempl_f = yf[8,2]  
gen min118_unempl_f = yf[9,2]  
gen min119_unempl_f = yf[10,2]  
gen min121_unempl_f = yf[11,2]  
gen min122_unempl_f = yf[12,2]  
gen min124_unempl_f = yf[13,2]  
gen min125_unempl_f = yf[14,2]  
gen min211_unempl_f = yf[15,2]  
gen min212_unempl_f = yf[16,2]  
gen min213_unempl_f = yf[17,2]  
gen min214_unempl_f = yf[18,2]  
gen min215_unempl_f = yf[19,2]  
gen min221_unempl_f = yf[20,2]  
gen min222_unempl_f = yf[21,2]  
gen min223_unempl_f = yf[22,2]  
gen min231_unempl_f = yf[23,2]  
gen min241_unempl_f = yf[24,2]  
gen min242_unempl_f = yf[25,2]  
gen min243_unempl_f = yf[26,2]  
gen min244_unempl_f = yf[27,2]  
gen min245_unempl_f = yf[28,2]  
gen min246_unempl_f = yf[29,2]  
gen min247_unempl_f = yf[30,2]  
gen min311_unempl_f = yf[31,2]  
gen min312_unempl_f = yf[32,2]  
gen min313_unempl_f = yf[33,2]  
gen min321_unempl_f = yf[34,2]  
gen min323_unempl_f = yf[35,2]  
gen min331_unempl_f = yf[36,2]  
gen min341_unempl_f = yf[37,2]  
gen min342_unempl_f = yf[38,2]  
gen min344_unempl_f = yf[39,2]  
gen min351_unempl_f = yf[40,2]  
gen min352_unempl_f = yf[41,2]  
gen min353_unempl_f = yf[42,2]  
gen min354_unempl_f = yf[43,2]  
gen min355_unempl_f = yf[44,2]  
gen min356_unempl_f = yf[45,2]  
gen min411_unempl_f = yf[46,2]  
gen min412_unempl_f = yf[47,2]  
gen min413_unempl_f = yf[48,2]  
gen min415_unempl_f = yf[49,2]  
gen min416_unempl_f = yf[50,2]  
gen min421_unempl_f = yf[51,2]  
gen min511_unempl_f = yf[52,2]  
gen min522_unempl_f = yf[53,2]  
gen min524_unempl_f = yf[54,2]  
gen min531_unempl_f = yf[55,2]  
gen min532_unempl_f = yf[56,2]  
gen min541_unempl_f = yf[57,2]  
gen min542_unempl_f = yf[58,2]  
gen min543_unempl_f = yf[59,2]  
gen min544_unempl_f = yf[60,2]  
gen min612_unempl_f = yf[61,2]  
gen min613_unempl_f = yf[62,2]  
gen min614_unempl_f = yf[63,2]  
gen min621_unempl_f = yf[64,2]  
gen min622_unempl_f = yf[65,2]  
gen min623_unempl_f = yf[66,2]  
gen min624_unempl_f = yf[67,2]  
gen min711_unempl_f = yf[68,2]  
gen min712_unempl_f = yf[69,2]  
gen min713_unempl_f = yf[70,2]  
gen min721_unempl_f = yf[71,2]  
gen min722_unempl_f = yf[72,2]  
gen min811_unempl_f = yf[73,2]  
gen min812_unempl_f = yf[74,2]  
gen min813_unempl_f = yf[75,2]  
gen min821_unempl_f = yf[76,2]  
gen min823_unempl_f = yf[77,2]  
gen min911_unempl_f = yf[78,2]  
gen min912_unempl_f = yf[79,2]  
gen min913_unempl_f = yf[80,2]  
gen min921_unempl_f = yf[81,2]  
gen min923_unempl_f = yf[82,2]  
gen min924_unempl_f = yf[83,2]  
gen min925_unempl_f = yf[84,2]  
gen min926_unempl_f = yf[85,2]  
gen min927_unempl_f = yf[86,2]  


qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active_m = min`j'_empl_m + min`j'_unempl_m
}



qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 355 356 411 412 413 415 416 421 511 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 823 911 912 913 921 923 924 925 926 927   {
gen min`j'_active_f = min`j'_empl_f + min`j'_unempl_f
}


qui foreach j in  111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our_m = min`j'_unempl_m / min`j'_active_m
}

qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 355 356 411 412 413 415 416 421 511 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 823 911 912 913 921 923 924 925 926 927   {
gen min`j'_our_f = min`j'_unempl_f / min`j'_active_f
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_octdec19
save "./ourmin_octdec19", replace
restore

preserve
keep min*_empl_* min*_unempl_*
duplicates drop min*, force
xpose , clear varname
rename v1 obs_octdec19
save "./obsmin_octdec19", replace
restore



use "UKDA-8671-stata/stata/stata13/lfsp_aj20_eul_pwt20", clear // Apr-Jun20

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT20

tab SC10MMJ ILODEFR if SEX == 1 [aw=PWT20], matcell(x)

matrix list x

gen maj1_empl_m = x[3,1]
gen maj2_empl_m = x[4,1]
gen maj3_empl_m = x[5,1]
gen maj4_empl_m = x[6,1]
gen maj5_empl_m = x[7,1]
gen maj6_empl_m = x[8,1]
gen maj7_empl_m = x[9,1]
gen maj8_empl_m = x[10,1]
gen maj9_empl_m = x[11,1]

tab SC10MMJ ILODEFR if SEX == 2 [aw=PWT20], matcell(xf)

matrix list xf

gen maj1_empl_f = xf[3,1]
gen maj2_empl_f = xf[4,1]
gen maj3_empl_f = xf[5,1]
gen maj4_empl_f = xf[6,1]
gen maj5_empl_f = xf[7,1]
gen maj6_empl_f = xf[8,1]
gen maj7_empl_f = xf[9,1]
gen maj8_empl_f = xf[10,1]
gen maj9_empl_f = xf[11,1]


tab SC10LMJ ILODEFR if SEX == 1 [aw=PWT20], matcell(y)

matrix list y

gen maj1_unempl_m = y[3,2]
gen maj2_unempl_m = y[4,2]
gen maj3_unempl_m = y[5,2]
gen maj4_unempl_m = y[6,2]
gen maj5_unempl_m = y[7,2]
gen maj6_unempl_m = y[8,2]
gen maj7_unempl_m = y[9,2]
gen maj8_unempl_m = y[10,2]
gen maj9_unempl_m = y[11,2]


tab SC10LMJ ILODEFR if SEX == 2 [aw=PWT20], matcell(yf)

matrix list yf

gen maj1_unempl_f = yf[3,2]
gen maj2_unempl_f = yf[4,2]
gen maj3_unempl_f = yf[5,2]
gen maj4_unempl_f = yf[6,2]
gen maj5_unempl_f = yf[7,2]
gen maj6_unempl_f = yf[8,2]
gen maj7_unempl_f = yf[9,2]
gen maj8_unempl_f = yf[10,2]
gen maj9_unempl_f = yf[11,2]



qui forval j = 1/9  {
gen maj`j'_active_m = maj`j'_empl_m + maj`j'_unempl_m
}

qui forval j = 1/9  {
gen maj`j'_active_f = maj`j'_empl_f + maj`j'_unempl_f
}


qui forval j = 1/9  {
gen maj`j'_our_m = maj`j'_unempl_m / maj`j'_active_m
}

qui forval j = 1/9  {
gen maj`j'_our_f = maj`j'_unempl_f / maj`j'_active_f
}

preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_aprjun20
save "./our_aprjun20", replace
restore

preserve
keep maj*_empl_* maj*_unempl_*
duplicates drop maj*, force
xpose , clear varname
rename v1 obs_aprjun20
save "./obs_aprjun20", replace
restore

tab SC10MMN ILODEFR if SEX == 1 [aw=PWT20], matcell(x)

matrix list x

gen min111_empl_m = x[3,1]  
gen min112_empl_m = x[4,1]  
gen min113_empl_m = x[5,1]  
gen min115_empl_m = x[6,1]  
gen min116_empl_m = x[7,1]  
gen min117_empl_m = x[8,1]  
gen min118_empl_m = x[9,1]  
gen min119_empl_m = x[10,1]  
gen min121_empl_m = x[11,1]  
gen min122_empl_m = x[12,1]  
gen min124_empl_m = x[13,1]  
gen min125_empl_m = x[14,1]  
gen min211_empl_m = x[15,1]  
gen min212_empl_m = x[16,1]  
gen min213_empl_m = x[17,1]  
gen min214_empl_m = x[18,1]  
gen min215_empl_m = x[19,1]  
gen min221_empl_m = x[20,1]  
gen min222_empl_m = x[21,1]  
gen min223_empl_m = x[22,1]  
gen min231_empl_m = x[23,1]  
gen min241_empl_m = x[24,1]  
gen min242_empl_m = x[25,1]  
gen min243_empl_m = x[26,1]  
gen min244_empl_m = x[27,1]  
gen min245_empl_m = x[28,1]  
gen min246_empl_m = x[29,1]  
gen min247_empl_m = x[30,1]  
gen min311_empl_m = x[31,1]  
gen min312_empl_m = x[32,1]  
gen min313_empl_m = x[33,1]  
gen min321_empl_m = x[34,1]  
gen min323_empl_m = x[35,1]  
gen min331_empl_m = x[36,1]  
gen min341_empl_m = x[37,1]  
gen min342_empl_m = x[38,1]  
gen min344_empl_m = x[39,1]  
gen min351_empl_m = x[40,1]  
gen min352_empl_m = x[41,1]  
gen min353_empl_m = x[42,1]  
gen min354_empl_m = x[43,1]  
gen min355_empl_m = x[44,1]  
gen min356_empl_m = x[45,1]  
gen min411_empl_m = x[46,1]  
gen min412_empl_m = x[47,1]  
gen min413_empl_m = x[48,1]  
gen min415_empl_m = x[49,1]  
gen min416_empl_m = x[50,1]  
gen min421_empl_m = x[51,1]  
gen min511_empl_m = x[52,1]  
gen min521_empl_m = x[53,1]  
gen min522_empl_m = x[54,1]  
gen min523_empl_m = x[55,1]  
gen min524_empl_m = x[56,1]  
gen min525_empl_m = x[57,1]  
gen min531_empl_m = x[58,1]  
gen min532_empl_m = x[59,1]  
gen min533_empl_m = x[60,1]  
gen min541_empl_m = x[61,1]  
gen min542_empl_m = x[62,1]  
gen min543_empl_m = x[63,1]  
gen min544_empl_m = x[64,1]  
gen min612_empl_m = x[65,1]  
gen min613_empl_m = x[66,1]  
gen min614_empl_m = x[67,1]  
gen min621_empl_m = x[68,1]  
gen min622_empl_m = x[69,1]  
gen min623_empl_m = x[70,1]  
gen min624_empl_m = x[71,1]  
gen min711_empl_m = x[72,1]  
gen min712_empl_m = x[73,1]  
gen min713_empl_m = x[74,1]  
gen min721_empl_m = x[75,1]  
gen min722_empl_m = x[76,1]  
gen min811_empl_m = x[77,1]  
gen min812_empl_m = x[78,1]  
gen min813_empl_m = x[79,1]  
gen min814_empl_m = x[80,1]  
gen min821_empl_m = x[81,1]  
gen min822_empl_m = x[82,1]  
gen min823_empl_m = x[83,1]  
gen min911_empl_m = x[84,1]  
gen min912_empl_m = x[85,1]  
gen min913_empl_m = x[86,1]  
gen min921_empl_m = x[87,1]  
gen min923_empl_m = x[88,1]  
gen min924_empl_m = x[89,1]  
gen min925_empl_m = x[90,1]  
gen min926_empl_m = x[91,1]  
gen min927_empl_m = x[92,1]  


tab SC10MMN ILODEFR if SEX == 2 [aw=PWT20], matcell(xf)

matrix list xf

gen min111_empl_f = xf[3,1]  
gen min112_empl_f = xf[4,1]  
gen min113_empl_f = xf[5,1]  
gen min115_empl_f = xf[6,1]  
gen min116_empl_f = xf[7,1]  
gen min117_empl_f = xf[8,1]  
gen min118_empl_f = xf[9,1]  
gen min119_empl_f = xf[10,1]  
gen min121_empl_f = xf[11,1]  
gen min122_empl_f = xf[12,1]  
gen min124_empl_f = xf[13,1]  
gen min125_empl_f = xf[14,1]  
gen min211_empl_f = xf[15,1]  
gen min212_empl_f = xf[16,1]  
gen min213_empl_f = xf[17,1]  
gen min214_empl_f = xf[18,1]  
gen min215_empl_f = xf[19,1]  
gen min221_empl_f = xf[20,1]  
gen min222_empl_f = xf[21,1]  
gen min223_empl_f = xf[22,1]  
gen min231_empl_f = xf[23,1]  
gen min241_empl_f = xf[24,1]  
gen min242_empl_f = xf[25,1]  
gen min243_empl_f = xf[26,1]  
gen min244_empl_f = xf[27,1]  
gen min245_empl_f = xf[28,1]  
gen min246_empl_f = xf[29,1]  
gen min247_empl_f = xf[30,1]  
gen min311_empl_f = xf[31,1]  
gen min312_empl_f = xf[32,1]  
gen min313_empl_f = xf[33,1]  
gen min321_empl_f = xf[34,1]  
gen min323_empl_f = xf[35,1]  
gen min331_empl_f = xf[36,1]  
gen min341_empl_f = xf[37,1]  
gen min342_empl_f = xf[38,1]  
gen min344_empl_f = xf[39,1]  
gen min351_empl_f = xf[40,1]  
gen min352_empl_f = xf[41,1]  
gen min353_empl_f = xf[42,1]  
gen min354_empl_f = xf[43,1]  
gen min355_empl_f = xf[44,1]  
gen min356_empl_f = xf[45,1]  
gen min411_empl_f = xf[46,1]  
gen min412_empl_f = xf[47,1]  
gen min413_empl_f = xf[48,1]  
gen min415_empl_f = xf[49,1]  
gen min416_empl_f = xf[50,1]  
gen min421_empl_f = xf[51,1]  
gen min511_empl_f = xf[52,1]  
gen min521_empl_f = xf[53,1]  
gen min522_empl_f = xf[54,1]  
gen min523_empl_f = xf[55,1]  
gen min524_empl_f = xf[56,1]  
gen min525_empl_f = xf[57,1]  
gen min531_empl_f = xf[58,1]  
gen min532_empl_f = xf[59,1]  
gen min533_empl_f = xf[60,1]  
gen min541_empl_f = xf[61,1]  
gen min542_empl_f = xf[62,1]  
gen min543_empl_f = xf[63,1]  
gen min544_empl_f = xf[64,1]  
gen min612_empl_f = xf[65,1]  
gen min613_empl_f = xf[66,1]  
gen min614_empl_f = xf[67,1]  
gen min621_empl_f = xf[68,1]  
gen min622_empl_f = xf[69,1]  
gen min623_empl_f = xf[70,1]  
gen min624_empl_f = xf[71,1]  
gen min711_empl_f = xf[72,1]  
gen min712_empl_f = xf[73,1]  
gen min713_empl_f = xf[74,1]  
gen min721_empl_f = xf[75,1]  
gen min722_empl_f = xf[76,1]  
gen min811_empl_f = xf[77,1]  
gen min812_empl_f = xf[78,1]  
gen min813_empl_f = xf[79,1]  
gen min814_empl_f = xf[80,1]  
gen min821_empl_f = xf[81,1]  
gen min822_empl_f = xf[82,1]  
gen min823_empl_f = xf[83,1]  
gen min911_empl_f = xf[84,1]  
gen min912_empl_f = xf[85,1]  
gen min913_empl_f = xf[86,1]  
gen min921_empl_f = xf[87,1]  
gen min923_empl_f = xf[88,1]  
gen min924_empl_f = xf[89,1]  
gen min925_empl_f = xf[90,1]  
gen min926_empl_f = xf[91,1]  
gen min927_empl_f = xf[92,1]  

tab SC10LMN ILODEFR if SEX == 1 [aw=PWT20], matcell(y)

matrix list y

gen min111_unempl_m = y[3,2]  
gen min112_unempl_m = y[4,2]  
gen min113_unempl_m = y[5,2]  
gen min115_unempl_m = y[6,2]  
gen min116_unempl_m = y[7,2]  
gen min117_unempl_m = y[8,2]  
gen min118_unempl_m = y[9,2]  
gen min119_unempl_m = y[10,2]  
gen min122_unempl_m = y[11,2]  
gen min124_unempl_m = y[12,2]  
gen min125_unempl_m = y[13,2]  
gen min211_unempl_m = y[14,2]  
gen min212_unempl_m = y[15,2]  
gen min213_unempl_m = y[16,2]  
gen min214_unempl_m = y[17,2]  
gen min215_unempl_m = y[18,2]  
gen min221_unempl_m = y[19,2]  
gen min222_unempl_m = y[20,2]  
gen min223_unempl_m = y[21,2]  
gen min231_unempl_m = y[22,2]  
gen min241_unempl_m = y[23,2]  
gen min242_unempl_m = y[24,2]  
gen min243_unempl_m = y[25,2]  
gen min244_unempl_m = y[26,2]  
gen min245_unempl_m = y[27,2]  
gen min246_unempl_m = y[28,2]  
gen min247_unempl_m = y[29,2]  
gen min311_unempl_m = y[30,2]  
gen min312_unempl_m = y[31,2]  
gen min313_unempl_m = y[32,2]  
gen min321_unempl_m = y[33,2]  
gen min323_unempl_m = y[34,2]  
gen min331_unempl_m = y[35,2]  
gen min341_unempl_m = y[36,2]  
gen min342_unempl_m = y[37,2]  
gen min344_unempl_m = y[38,2]  
gen min351_unempl_m = y[39,2]  
gen min352_unempl_m = y[40,2]  
gen min353_unempl_m = y[41,2]  
gen min354_unempl_m = y[42,2]  
gen min355_unempl_m = y[43,2]  
gen min356_unempl_m = y[44,2]  
gen min411_unempl_m = y[45,2]  
gen min412_unempl_m = y[46,2]  
gen min413_unempl_m = y[47,2]  
gen min415_unempl_m = y[48,2]  
gen min416_unempl_m = y[49,2]  
gen min421_unempl_m = y[50,2]  
gen min511_unempl_m = y[51,2]  
gen min521_unempl_m = y[52,2]  
gen min522_unempl_m = y[53,2]  
gen min523_unempl_m = y[54,2]  
gen min524_unempl_m = y[55,2]  
gen min525_unempl_m = y[56,2]  
gen min531_unempl_m = y[57,2]  
gen min532_unempl_m = y[58,2]  
gen min533_unempl_m = y[59,2]  
gen min541_unempl_m = y[60,2]  
gen min542_unempl_m = y[61,2]  
gen min543_unempl_m = y[62,2]  
gen min544_unempl_m = y[63,2]  
gen min612_unempl_m = y[64,2]  
gen min613_unempl_m = y[65,2]  
gen min614_unempl_m = y[66,2]  
gen min621_unempl_m = y[67,2]  
gen min622_unempl_m = y[68,2]  
gen min623_unempl_m = y[69,2]  
gen min624_unempl_m = y[70,2]  
gen min711_unempl_m = y[71,2]  
gen min712_unempl_m = y[72,2]  
gen min713_unempl_m = y[73,2]  
gen min721_unempl_m = y[74,2]  
gen min722_unempl_m = y[75,2]  
gen min811_unempl_m = y[76,2]  
gen min812_unempl_m = y[77,2]  
gen min813_unempl_m = y[78,2]  
gen min814_unempl_m = y[79,2]  
gen min821_unempl_m = y[80,2]  
gen min822_unempl_m = y[81,2]  
gen min823_unempl_m = y[82,2]  
gen min911_unempl_m = y[83,2]  
gen min912_unempl_m = y[84,2]  
gen min913_unempl_m = y[85,2]  
gen min921_unempl_m = y[86,2]  
gen min923_unempl_m = y[87,2]  
gen min924_unempl_m = y[88,2]  
gen min925_unempl_m = y[89,2]  
gen min926_unempl_m = y[90,2]  
gen min927_unempl_m = y[91,2]  


tab SC10LMN ILODEFR if SEX == 2 [aw=PWT20], matcell(yf)

matrix list yf

gen min111_unempl_f = yf[3,2]  
gen min112_unempl_f = yf[4,2]  
gen min113_unempl_f = yf[5,2]  
gen min115_unempl_f = yf[6,2]  
gen min116_unempl_f = yf[7,2]  
gen min117_unempl_f = yf[8,2]  
gen min118_unempl_f = yf[9,2]  
gen min119_unempl_f = yf[10,2]  
gen min121_unempl_f = yf[11,2]  
gen min122_unempl_f = yf[12,2]  
gen min124_unempl_f = yf[13,2]  
gen min125_unempl_f = yf[14,2]  
gen min211_unempl_f = yf[15,2]  
gen min212_unempl_f = yf[16,2]  
gen min213_unempl_f = yf[17,2]  
gen min214_unempl_f = yf[18,2]  
gen min215_unempl_f = yf[19,2]  
gen min221_unempl_f = yf[20,2]  
gen min222_unempl_f = yf[21,2]  
gen min223_unempl_f = yf[22,2]  
gen min231_unempl_f = yf[23,2]  
gen min241_unempl_f = yf[24,2]  
gen min242_unempl_f = yf[25,2]  
gen min243_unempl_f = yf[26,2]  
gen min244_unempl_f = yf[27,2]  
gen min245_unempl_f = yf[28,2]  
gen min246_unempl_f = yf[29,2]  
gen min247_unempl_f = yf[30,2]  
gen min311_unempl_f = yf[31,2]  
gen min312_unempl_f = yf[32,2]  
gen min313_unempl_f = yf[33,2]  
gen min321_unempl_f = yf[34,2]  
gen min323_unempl_f = yf[35,2]  
gen min331_unempl_f = yf[36,2]  
gen min341_unempl_f = yf[37,2]  
gen min342_unempl_f = yf[38,2]  
gen min344_unempl_f = yf[39,2]  
gen min351_unempl_f = yf[40,2]  
gen min352_unempl_f = yf[41,2]  
gen min353_unempl_f = yf[42,2]  
gen min354_unempl_f = yf[43,2]  
gen min356_unempl_f = yf[44,2]  
gen min411_unempl_f = yf[45,2]  
gen min412_unempl_f = yf[46,2]  
gen min413_unempl_f = yf[47,2]  
gen min415_unempl_f = yf[48,2]  
gen min416_unempl_f = yf[49,2]  
gen min421_unempl_f = yf[50,2]  
gen min511_unempl_f = yf[51,2]  
gen min522_unempl_f = yf[52,2]  
gen min524_unempl_f = yf[53,2]  
gen min531_unempl_f = yf[54,2]  
gen min532_unempl_f = yf[55,2]  
gen min541_unempl_f = yf[56,2]  
gen min542_unempl_f = yf[57,2]  
gen min543_unempl_f = yf[58,2]  
gen min544_unempl_f = yf[59,2]  
gen min612_unempl_f = yf[60,2]  
gen min613_unempl_f = yf[61,2]  
gen min614_unempl_f = yf[62,2]  
gen min621_unempl_f = yf[63,2]  
gen min622_unempl_f = yf[64,2]  
gen min623_unempl_f = yf[65,2]  
gen min624_unempl_f = yf[66,2]  
gen min711_unempl_f = yf[67,2]  
gen min712_unempl_f = yf[68,2]  
gen min713_unempl_f = yf[69,2]  
gen min721_unempl_f = yf[70,2]  
gen min722_unempl_f = yf[71,2]  
gen min811_unempl_f = yf[72,2]  
gen min812_unempl_f = yf[73,2]  
gen min813_unempl_f = yf[74,2]  
gen min821_unempl_f = yf[75,2]  
gen min822_unempl_f = yf[76,2]  
gen min911_unempl_f = yf[77,2]  
gen min912_unempl_f = yf[78,2]  
gen min913_unempl_f = yf[79,2]  
gen min921_unempl_f = yf[80,2]  
gen min923_unempl_f = yf[81,2]  
gen min924_unempl_f = yf[82,2]  
gen min925_unempl_f = yf[83,2]  
gen min926_unempl_f = yf[84,2]  
gen min927_unempl_f = yf[85,2]  


qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active_m = min`j'_empl_m + min`j'_unempl_m
}



qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 356 411 412 413 415 416 421 511 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 911 912 913 921 923 924 925 926 927   {
gen min`j'_active_f = min`j'_empl_f + min`j'_unempl_f
}


qui foreach j in  111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our_m = min`j'_unempl_m / min`j'_active_m
}

qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 352 353 354 356 411 412 413 415 416 421 511 522 524 531 532 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 821 911 912 913 921 923 924 925 926 927   {
gen min`j'_our_f = min`j'_unempl_f / min`j'_active_f
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_aprjun20
save "./ourmin_aprjun20", replace
restore

preserve
keep min*_empl_* min*_unempl_*
duplicates drop min*, force
xpose , clear varname
rename v1 obs_aprjun20
save "./obsmin_aprjun20", replace
restore


use "./obs_aprjun18", clear
merge 1:1 _varname using "./obs_janmar19"
drop _merge
merge 1:1 _varname using  "./obs_octdec19"
drop _merge
merge 1:1 _varname using "./obs_aprjun20"
drop _merge
order _varname 
rename _varname soc_major

gen gender = substr(soc_major, 6,10)

replace soc_major = substr(soc_major, 1,4)
replace soc_major = substr(soc_major, 4,4)
destring soc_major, replace
save "./obs.dta", replace
export delimited "./obs.txt", delimiter(tab) replace

rm "./obs_aprjun18.dta"
rm "./obs_janmar19.dta"
rm "./obs_octdec19.dta"
rm "./obs_aprjun20.dta"


use "./our_aprjun18", clear
merge 1:1 _varname using "./our_janmar19"
drop _merge
merge 1:1 _varname using  "./our_octdec19"
drop _merge
merge 1:1 _varname using "./our_aprjun20"
drop _merge
order _varname 
rename _varname soc_major

gen gender = substr(soc_major, 10,10)

replace soc_major = substr(soc_major, 1,4)
replace soc_major = substr(soc_major, 4,4)
destring soc_major, replace

save "./our.dta", replace
export delimited "./our.txt", delimiter(tab) replace

rm "./our_aprjun18.dta"
rm "./our_janmar19.dta"
rm "./our_octdec19.dta"
rm "./our_aprjun20.dta"


use "./obsmin_aprjun18", clear
merge 1:1 _varname using "./obsmin_janmar19"
drop _merge
merge 1:1 _varname using  "./obsmin_octdec19"
drop _merge
merge 1:1 _varname using "./obsmin_aprjun20"
drop _merge
order _varname 
rename _varname soc_minor

gen gender = substr(soc_minor, 8,10)

replace soc_minor = substr(soc_minor, 1,6)
replace soc_minor = substr(soc_minor, 4,6)
destring soc_minor, replace

save "./obsmin.dta", replace
export delimited "./obsmin.txt", delimiter(tab) replace

rm "./obsmin_aprjun18.dta"
rm "./obsmin_janmar19.dta"
rm "./obsmin_octdec19.dta"
rm "./obsmin_aprjun20.dta"


use "./ourmin_aprjun18", clear
merge 1:1 _varname using "./ourmin_janmar19"
drop _merge
merge 1:1 _varname using  "./ourmin_octdec19"
drop _merge
merge 1:1 _varname using "./ourmin_aprjun20"
drop _merge
order _varname 
rename _varname soc_minor

gen gender = substr(soc_minor, 8,10)

replace soc_minor = substr(soc_minor, 1,6)
replace soc_minor = substr(soc_minor, 4,6)
destring soc_minor, replace

save "./ourmin.dta", replace
export delimited "./ourmin.txt", delimiter(tab) replace

rm "./ourmin_aprjun18.dta"
rm "./ourmin_janmar19.dta"
rm "./ourmin_octdec19.dta"
rm "./ourmin_aprjun20.dta"

********************************************************************************

* 		Combined Measure

********************************************************************************

use "./UKDA-8381-stata/stata/stata11/lfsp_aj18_eul", clear // Apr-Jun18

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 


tab SC10MMJ ILODEFR [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl = x[3,1]
gen maj2_empl = x[4,1]
gen maj3_empl = x[5,1]
gen maj4_empl = x[6,1]
gen maj5_empl = x[7,1]
gen maj6_empl = x[8,1]
gen maj7_empl = x[9,1]
gen maj8_empl = x[10,1]
gen maj9_empl = x[11,1]


tab SC10LMJ ILODEFR [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl = y[3,2]
gen maj2_unempl = y[4,2]
gen maj3_unempl = y[5,2]
gen maj4_unempl = y[6,2]
gen maj5_unempl = y[7,2]
gen maj6_unempl = y[8,2]
gen maj7_unempl = y[9,2]
gen maj8_unempl = y[10,2]
gen maj9_unempl = y[11,2]


qui forval j = 1/9  {
gen maj`j'_active = maj`j'_empl + maj`j'_unempl
}

qui forval j = 1/9  {
gen maj`j'_our = maj`j'_unempl / maj`j'_active
}


preserve
keep maj*_our* 

duplicates drop maj*, force
xpose , clear varname
rename v1 our_aprjun18
save "./our_combined_aprjun18", replace
restore

tab SC10MMN ILODEFR   [aw=PWT18], matcell(x)

matrix list x

gen min111_empl = x[3,1]  
gen min112_empl = x[4,1]  
gen min113_empl = x[5,1]  
gen min115_empl = x[6,1]  
gen min116_empl = x[7,1]  
gen min117_empl = x[8,1]  
gen min118_empl = x[9,1]  
gen min119_empl = x[10,1]  
gen min121_empl = x[11,1]  
gen min122_empl = x[12,1]  
gen min124_empl = x[13,1]  
gen min125_empl = x[14,1]  
gen min211_empl = x[15,1]  
gen min212_empl = x[16,1]  
gen min213_empl = x[17,1]  
gen min214_empl = x[18,1]  
gen min215_empl = x[19,1]  
gen min221_empl = x[20,1]  
gen min222_empl = x[21,1]  
gen min223_empl = x[22,1]  
gen min231_empl = x[23,1]  
gen min241_empl = x[24,1]  
gen min242_empl = x[25,1]  
gen min243_empl = x[26,1]  
gen min244_empl = x[27,1]  
gen min245_empl = x[28,1]  
gen min246_empl = x[29,1]  
gen min247_empl = x[30,1]  
gen min311_empl = x[31,1]  
gen min312_empl = x[32,1]  
gen min313_empl = x[33,1]  
gen min321_empl = x[34,1]  
gen min323_empl = x[35,1]  
gen min331_empl = x[36,1]  
gen min341_empl = x[37,1]  
gen min342_empl = x[38,1]  
gen min344_empl = x[39,1]  
gen min351_empl = x[40,1]  
gen min352_empl = x[41,1]  
gen min353_empl = x[42,1]  
gen min354_empl = x[43,1]  
gen min355_empl = x[44,1]  
gen min356_empl = x[45,1]  
gen min411_empl = x[46,1]  
gen min412_empl = x[47,1]  
gen min413_empl = x[48,1]  
gen min415_empl = x[49,1]  
gen min416_empl = x[50,1]  
gen min421_empl = x[51,1]  
gen min511_empl = x[52,1]  
gen min521_empl = x[53,1]  
gen min522_empl = x[54,1]  
gen min523_empl = x[55,1]  
gen min524_empl = x[56,1]  
gen min525_empl = x[57,1]  
gen min531_empl = x[58,1]  
gen min532_empl = x[59,1]  
gen min533_empl = x[60,1]  
gen min541_empl = x[61,1]  
gen min542_empl = x[62,1]  
gen min543_empl = x[63,1]  
gen min544_empl = x[64,1]  
gen min612_empl = x[65,1]  
gen min613_empl = x[66,1]  
gen min614_empl = x[67,1]  
gen min621_empl = x[68,1]  
gen min622_empl = x[69,1]  
gen min623_empl = x[70,1]  
gen min624_empl = x[71,1]  
gen min711_empl = x[72,1]  
gen min712_empl = x[73,1]  
gen min713_empl = x[74,1]  
gen min721_empl = x[75,1]  
gen min722_empl = x[76,1]  
gen min811_empl = x[77,1]  
gen min812_empl = x[78,1]  
gen min813_empl = x[79,1]  
gen min814_empl = x[80,1]  
gen min821_empl = x[81,1]  
gen min822_empl = x[82,1]  
gen min823_empl = x[83,1]  
gen min911_empl = x[84,1]  
gen min912_empl = x[85,1]  
gen min913_empl = x[86,1]  
gen min921_empl = x[87,1]  
gen min923_empl = x[88,1]  
gen min924_empl = x[89,1]  
gen min925_empl = x[90,1]  
gen min926_empl = x[91,1]  
gen min927_empl = x[92,1]  


tab SC10LMN ILODEFR  [aw=PWT18], matcell(y)

matrix list y
gen min111_unempl = y[3,2]  
gen min112_unempl = y[4,2]  
gen min113_unempl = y[5,2]  
gen min115_unempl = y[6,2]  
gen min116_unempl = y[7,2]  
gen min117_unempl = y[8,2]  
gen min118_unempl = y[9,2]  
gen min119_unempl = y[10,2]  
gen min121_unempl = y[11,2]  
gen min122_unempl = y[12,2]  
gen min125_unempl = y[13,2]  
gen min211_unempl = y[14,2]  
gen min212_unempl = y[15,2]  
gen min213_unempl = y[16,2]  
gen min214_unempl = y[17,2]  
gen min221_unempl = y[18,2]  
gen min222_unempl = y[19,2]  
gen min223_unempl = y[20,2]  
gen min231_unempl = y[21,2]  
gen min241_unempl = y[22,2]  
gen min242_unempl = y[23,2]  
gen min243_unempl = y[24,2]  
gen min244_unempl = y[25,2]  
gen min245_unempl = y[26,2]  
gen min246_unempl = y[27,2]  
gen min247_unempl = y[28,2]  
gen min311_unempl = y[29,2]  
gen min312_unempl = y[30,2]  
gen min313_unempl = y[31,2]  
gen min321_unempl = y[32,2]  
gen min323_unempl = y[33,2]  
gen min331_unempl = y[34,2]  
gen min341_unempl = y[35,2]  
gen min342_unempl = y[36,2]  
gen min344_unempl = y[37,2]  
gen min351_unempl = y[38,2]  
gen min352_unempl = y[39,2]  
gen min353_unempl = y[40,2]  
gen min354_unempl = y[41,2]  
gen min356_unempl = y[42,2]  
gen min411_unempl = y[43,2]  
gen min412_unempl = y[44,2]  
gen min413_unempl = y[45,2]  
gen min415_unempl = y[46,2]  
gen min416_unempl = y[47,2]  
gen min421_unempl = y[48,2]  
gen min511_unempl = y[49,2]  
gen min521_unempl = y[50,2]  
gen min522_unempl = y[51,2]  
gen min523_unempl = y[52,2]  
gen min524_unempl = y[53,2]  
gen min525_unempl = y[54,2]  
gen min531_unempl = y[55,2]  
gen min532_unempl = y[56,2]  
gen min533_unempl = y[57,2]  
gen min541_unempl = y[58,2]  
gen min542_unempl = y[59,2]  
gen min543_unempl = y[60,2]  
gen min544_unempl = y[61,2]  
gen min612_unempl = y[62,2]  
gen min613_unempl = y[63,2]  
gen min614_unempl = y[64,2]  
gen min621_unempl = y[65,2]  
gen min622_unempl = y[66,2]  
gen min623_unempl = y[67,2]  
gen min624_unempl = y[68,2]  
gen min711_unempl = y[69,2]  
gen min712_unempl = y[70,2]  
gen min713_unempl = y[71,2]  
gen min721_unempl = y[72,2]  
gen min722_unempl = y[73,2]  
gen min811_unempl = y[74,2]  
gen min812_unempl = y[75,2]  
gen min813_unempl = y[76,2]  
gen min814_unempl = y[77,2]  
gen min821_unempl = y[78,2]  
gen min822_unempl = y[79,2]  
gen min823_unempl = y[80,2]  
gen min911_unempl = y[81,2]  
gen min912_unempl = y[82,2]  
gen min913_unempl = y[83,2]  
gen min921_unempl = y[84,2]  
gen min923_unempl = y[85,2]  
gen min924_unempl = y[86,2]  
gen min925_unempl = y[87,2]  

qui foreach j in 111 112 113 115 116 117 118 119 121 122 125 211 212 213 214 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354   356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925  {
gen min`j'_active = min`j'_empl + min`j'_unempl
}

qui foreach j in  111 112 113 115 116 117 118 119 121 122 125 211 212 213 214 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354   356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925  {
gen min`j'_our = min`j'_unempl / min`j'_active
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_aprjun18
save "./ourmin_combined_aprjun18", replace
restore


use "UKDA-8485-stata/stata/stata13/lfsp_jm19_eul_pwt18", clear // Jan-Mar19

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 

tab SC10MMJ ILODEFR [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl = x[3,1]
gen maj2_empl = x[4,1]
gen maj3_empl = x[5,1]
gen maj4_empl = x[6,1]
gen maj5_empl = x[7,1]
gen maj6_empl = x[8,1]
gen maj7_empl = x[9,1]
gen maj8_empl = x[10,1]
gen maj9_empl = x[11,1]


tab SC10LMJ ILODEFR  [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl = y[3,2]
gen maj2_unempl = y[4,2]
gen maj3_unempl = y[5,2]
gen maj4_unempl = y[6,2]
gen maj5_unempl = y[7,2]
gen maj6_unempl = y[8,2]
gen maj7_unempl = y[9,2]
gen maj8_unempl = y[10,2]
gen maj9_unempl = y[11,2]



qui forval j = 1/9  {
gen maj`j'_active = maj`j'_empl + maj`j'_unempl
}

qui forval j = 1/9  {
gen maj`j'_our = maj`j'_unempl / maj`j'_active
}


preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_janmar19
save "./our_combined_janmar19", replace
restore

tab SC10MMN ILODEFR  [aw=PWT18], matcell(x)

matrix list x

gen min111_empl = x[3,1]  
gen min112_empl = x[4,1]  
gen min113_empl = x[5,1]  
gen min115_empl = x[6,1]  
gen min116_empl = x[7,1]  
gen min117_empl = x[8,1]  
gen min118_empl = x[9,1]  
gen min119_empl = x[10,1]  
gen min121_empl = x[11,1]  
gen min122_empl = x[12,1]  
gen min124_empl = x[13,1]  
gen min125_empl = x[14,1]  
gen min211_empl = x[15,1]  
gen min212_empl = x[16,1]  
gen min213_empl = x[17,1]  
gen min214_empl = x[18,1]  
gen min215_empl = x[19,1]  
gen min221_empl = x[20,1]  
gen min222_empl = x[21,1]  
gen min223_empl = x[22,1]  
gen min231_empl = x[23,1]  
gen min241_empl = x[24,1]  
gen min242_empl = x[25,1]  
gen min243_empl = x[26,1]  
gen min244_empl = x[27,1]  
gen min245_empl = x[28,1]  
gen min246_empl = x[29,1]  
gen min247_empl = x[30,1]  
gen min311_empl = x[31,1]  
gen min312_empl = x[32,1]  
gen min313_empl = x[33,1]  
gen min321_empl = x[34,1]  
gen min323_empl = x[35,1]  
gen min331_empl = x[36,1]  
gen min341_empl = x[37,1]  
gen min342_empl = x[38,1]  
gen min344_empl = x[39,1]  
gen min351_empl = x[40,1]  
gen min352_empl = x[41,1]  
gen min353_empl = x[42,1]  
gen min354_empl = x[43,1]  
gen min355_empl = x[44,1]  
gen min356_empl = x[45,1]  
gen min411_empl = x[46,1]  
gen min412_empl = x[47,1]  
gen min413_empl = x[48,1]  
gen min415_empl = x[49,1]  
gen min416_empl = x[50,1]  
gen min421_empl = x[51,1]  
gen min511_empl = x[52,1]  
gen min521_empl = x[53,1]  
gen min522_empl = x[54,1]  
gen min523_empl = x[55,1]  
gen min524_empl = x[56,1]  
gen min525_empl = x[57,1]  
gen min531_empl = x[58,1]  
gen min532_empl = x[59,1]  
gen min533_empl = x[60,1]  
gen min541_empl = x[61,1]  
gen min542_empl = x[62,1]  
gen min543_empl = x[63,1]  
gen min544_empl = x[64,1]  
gen min612_empl = x[65,1]  
gen min613_empl = x[66,1]  
gen min614_empl = x[67,1]  
gen min621_empl = x[68,1]  
gen min622_empl = x[69,1]  
gen min623_empl = x[70,1]  
gen min624_empl = x[71,1]  
gen min711_empl = x[72,1]  
gen min712_empl = x[73,1]  
gen min713_empl = x[74,1]  
gen min721_empl = x[75,1]  
gen min722_empl = x[76,1]  
gen min811_empl = x[77,1]  
gen min812_empl = x[78,1]  
gen min813_empl = x[79,1]  
gen min814_empl = x[80,1]  
gen min821_empl = x[81,1]  
gen min822_empl = x[82,1]  
gen min823_empl = x[83,1]  
gen min911_empl = x[84,1]  
gen min912_empl = x[85,1]  
gen min913_empl = x[86,1]  
gen min921_empl = x[87,1]  
gen min923_empl = x[88,1]  
gen min924_empl = x[89,1]  
gen min925_empl = x[90,1]  
gen min926_empl = x[91,1]  
gen min927_empl = x[92,1]  

tab SC10LMN ILODEFR   [aw=PWT18], matcell(y)

matrix list y

gen min111_unempl = y[3,2]  
gen min112_unempl = y[4,2]  
gen min113_unempl = y[5,2]  
gen min115_unempl = y[6,2]  
gen min116_unempl = y[7,2]  
gen min117_unempl = y[8,2]  
gen min118_unempl = y[9,2]  
gen min119_unempl = y[10,2]  
gen min121_unempl = y[11,2]  
gen min122_unempl = y[12,2]  
gen min124_unempl = y[13,2]  
gen min125_unempl = y[14,2]  
gen min211_unempl = y[15,2]  
gen min212_unempl = y[16,2]  
gen min213_unempl = y[17,2]  
gen min214_unempl = y[18,2]  
gen min215_unempl = y[19,2]  
gen min221_unempl = y[20,2]  
gen min222_unempl = y[21,2]  
gen min223_unempl = y[22,2]  
gen min231_unempl = y[23,2]  
gen min241_unempl = y[24,2]  
gen min242_unempl = y[25,2]  
gen min243_unempl = y[26,2]  
gen min244_unempl = y[27,2]  
gen min245_unempl = y[28,2]  
gen min246_unempl = y[29,2]  
gen min247_unempl = y[30,2]  
gen min311_unempl = y[31,2]  
gen min312_unempl = y[32,2]  
gen min313_unempl = y[33,2]  
gen min321_unempl = y[34,2]  
gen min323_unempl = y[35,2]  
gen min331_unempl = y[36,2]  
gen min341_unempl = y[37,2]  
gen min342_unempl = y[38,2]  
gen min344_unempl = y[39,2]  
gen min351_unempl = y[40,2]  
gen min352_unempl = y[41,2]  
gen min353_unempl = y[42,2]  
gen min354_unempl = y[43,2]  
gen min356_unempl = y[44,2]  
gen min411_unempl = y[45,2]  
gen min412_unempl = y[46,2]  
gen min413_unempl = y[47,2]  
gen min415_unempl = y[48,2]  
gen min416_unempl = y[49,2]  
gen min421_unempl = y[50,2]  
gen min511_unempl = y[51,2]  
gen min521_unempl = y[52,2]  
gen min522_unempl = y[53,2]  
gen min523_unempl = y[54,2]  
gen min524_unempl = y[55,2]  
gen min525_unempl = y[56,2]  
gen min531_unempl = y[57,2]  
gen min532_unempl = y[58,2]  
gen min533_unempl = y[59,2]  
gen min541_unempl = y[60,2]  
gen min542_unempl = y[61,2]  
gen min543_unempl = y[62,2]  
gen min544_unempl = y[63,2]  
gen min612_unempl = y[64,2]  
gen min613_unempl = y[65,2]  
gen min614_unempl = y[66,2]  
gen min621_unempl = y[67,2]  
gen min622_unempl = y[68,2]  
gen min623_unempl = y[69,2]  
gen min624_unempl = y[70,2]  
gen min711_unempl = y[71,2]  
gen min712_unempl = y[72,2]  
gen min713_unempl = y[73,2]  
gen min721_unempl = y[74,2]  
gen min722_unempl = y[75,2]  
gen min811_unempl = y[76,2]  
gen min812_unempl = y[77,2]  
gen min813_unempl = y[78,2]  
gen min814_unempl = y[79,2]  
gen min821_unempl = y[80,2]  
gen min822_unempl = y[81,2]  
gen min823_unempl = y[82,2]  
gen min911_unempl = y[83,2]  
gen min912_unempl = y[84,2]  
gen min913_unempl = y[85,2]  
gen min921_unempl = y[86,2]  
gen min923_unempl = y[87,2]  
gen min924_unempl = y[88,2]  
gen min925_unempl = y[89,2]  
gen min926_unempl = y[90,2]  
gen min927_unempl = y[91,2]  


qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active = min`j'_empl + min`j'_unempl
}



qui foreach j in  111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our = min`j'_unempl / min`j'_active
}


preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_janmar19
save "./ourmin_combined_janmar19", replace
restore

use "UKDA-8614-stata/stata/stata13/lfsp_od19_eul", clear // Oct-Dec19

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT18 

tab SC10MMJ ILODEFR  [aw=PWT18], matcell(x)

matrix list x

gen maj1_empl = x[3,1]
gen maj2_empl = x[4,1]
gen maj3_empl = x[5,1]
gen maj4_empl = x[6,1]
gen maj5_empl = x[7,1]
gen maj6_empl = x[8,1]
gen maj7_empl = x[9,1]
gen maj8_empl = x[10,1]
gen maj9_empl = x[11,1]

tab SC10LMJ ILODEFR [aw=PWT18], matcell(y)

matrix list y

gen maj1_unempl = y[3,2]
gen maj2_unempl = y[4,2]
gen maj3_unempl = y[5,2]
gen maj4_unempl = y[6,2]
gen maj5_unempl = y[7,2]
gen maj6_unempl = y[8,2]
gen maj7_unempl = y[9,2]
gen maj8_unempl = y[10,2]
gen maj9_unempl = y[11,2]


qui forval j = 1/9  {
gen maj`j'_active = maj`j'_empl + maj`j'_unempl
}


qui forval j = 1/9  {
gen maj`j'_our = maj`j'_unempl / maj`j'_active
}

preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_octdec19
save "./our_combined_octdec19", replace
restore

tab SC10MMN ILODEFR  [aw=PWT18], matcell(x)

matrix list x

gen min111_empl = x[3,1]  
gen min112_empl = x[4,1]  
gen min113_empl = x[5,1]  
gen min115_empl = x[6,1]  
gen min116_empl = x[7,1]  
gen min117_empl = x[8,1]  
gen min118_empl = x[9,1]  
gen min119_empl = x[10,1]  
gen min121_empl = x[11,1]  
gen min122_empl = x[12,1]  
gen min124_empl = x[13,1]  
gen min125_empl = x[14,1]  
gen min211_empl = x[15,1]  
gen min212_empl = x[16,1]  
gen min213_empl = x[17,1]  
gen min214_empl = x[18,1]  
gen min215_empl = x[19,1]  
gen min221_empl = x[20,1]  
gen min222_empl = x[21,1]  
gen min223_empl = x[22,1]  
gen min231_empl = x[23,1]  
gen min241_empl = x[24,1]  
gen min242_empl = x[25,1]  
gen min243_empl = x[26,1]  
gen min244_empl = x[27,1]  
gen min245_empl = x[28,1]  
gen min246_empl = x[29,1]  
gen min247_empl = x[30,1]  
gen min311_empl = x[31,1]  
gen min312_empl = x[32,1]  
gen min313_empl = x[33,1]  
gen min321_empl = x[34,1]  
gen min323_empl = x[35,1]  
gen min331_empl = x[36,1]  
gen min341_empl = x[37,1]  
gen min342_empl = x[38,1]  
gen min344_empl = x[39,1]  
gen min351_empl = x[40,1]  
gen min352_empl = x[41,1]  
gen min353_empl = x[42,1]  
gen min354_empl = x[43,1]  
gen min355_empl = x[44,1]  
gen min356_empl = x[45,1]  
gen min411_empl = x[46,1]  
gen min412_empl = x[47,1]  
gen min413_empl = x[48,1]  
gen min415_empl = x[49,1]  
gen min416_empl = x[50,1]  
gen min421_empl = x[51,1]  
gen min511_empl = x[52,1]  
gen min521_empl = x[53,1]  
gen min522_empl = x[54,1]  
gen min523_empl = x[55,1]  
gen min524_empl = x[56,1]  
gen min525_empl = x[57,1]  
gen min531_empl = x[58,1]  
gen min532_empl = x[59,1]  
gen min533_empl = x[60,1]  
gen min541_empl = x[61,1]  
gen min542_empl = x[62,1]  
gen min543_empl = x[63,1]  
gen min544_empl = x[64,1]  
gen min612_empl = x[65,1]  
gen min613_empl = x[66,1]  
gen min614_empl = x[67,1]  
gen min621_empl = x[68,1]  
gen min622_empl = x[69,1]  
gen min623_empl = x[70,1]  
gen min624_empl = x[71,1]  
gen min711_empl = x[72,1]  
gen min712_empl = x[73,1]  
gen min713_empl = x[74,1]  
gen min721_empl = x[75,1]  
gen min722_empl = x[76,1]  
gen min811_empl = x[77,1]  
gen min812_empl = x[78,1]  
gen min813_empl = x[79,1]  
gen min814_empl = x[80,1]  
gen min821_empl = x[81,1]  
gen min822_empl = x[82,1]  
gen min823_empl = x[83,1]  
gen min911_empl = x[84,1]  
gen min912_empl = x[85,1]  
gen min913_empl = x[86,1]  
gen min921_empl = x[87,1]  
gen min923_empl = x[88,1]  
gen min924_empl = x[89,1]  
gen min925_empl = x[90,1]  
gen min926_empl = x[91,1]  
gen min927_empl = x[92,1]  

tab SC10LMN ILODEFR  [aw=PWT18], matcell(y)

matrix list y

gen min111_unempl = y[3,2]   
gen min112_unempl = y[4,2]   
gen min113_unempl = y[5,2]   
gen min115_unempl = y[6,2]   
gen min116_unempl = y[7,2]   
gen min117_unempl = y[8,2]   
gen min118_unempl = y[9,2]   
gen min119_unempl = y[10,2]   
gen min121_unempl = y[11,2]   
gen min122_unempl = y[12,2]   
gen min124_unempl = y[13,2]   
gen min125_unempl = y[14,2]   
gen min211_unempl = y[15,2]   
gen min212_unempl = y[16,2]   
gen min213_unempl = y[17,2]   
gen min214_unempl = y[18,2]   
gen min215_unempl = y[19,2]   
gen min221_unempl = y[20,2]   
gen min222_unempl = y[21,2]   
gen min223_unempl = y[22,2]   
gen min231_unempl = y[23,2]   
gen min241_unempl = y[24,2]   
gen min242_unempl = y[25,2]   
gen min243_unempl = y[26,2]   
gen min244_unempl = y[27,2]   
gen min245_unempl = y[28,2]   
gen min246_unempl = y[29,2]   
gen min247_unempl = y[30,2]   
gen min311_unempl = y[31,2]   
gen min312_unempl = y[32,2]   
gen min313_unempl = y[33,2]   
gen min321_unempl = y[34,2]   
gen min323_unempl = y[35,2]   
gen min331_unempl = y[36,2]   
gen min341_unempl = y[37,2]   
gen min342_unempl = y[38,2]   
gen min344_unempl = y[39,2]   
gen min351_unempl = y[40,2]   
gen min352_unempl = y[41,2]   
gen min353_unempl = y[42,2]   
gen min354_unempl = y[43,2]   
gen min355_unempl = y[44,2]   
gen min356_unempl = y[45,2]   
gen min411_unempl = y[46,2]   
gen min412_unempl = y[47,2]   
gen min413_unempl = y[48,2]   
gen min415_unempl = y[49,2]   
gen min416_unempl = y[50,2]   
gen min421_unempl = y[51,2]   
gen min511_unempl = y[52,2]   
gen min521_unempl = y[53,2]   
gen min522_unempl = y[54,2]   
gen min523_unempl = y[55,2]   
gen min524_unempl = y[56,2]   
gen min525_unempl = y[57,2]   
gen min531_unempl = y[58,2]   
gen min532_unempl = y[59,2]   
gen min533_unempl = y[60,2]   
gen min541_unempl = y[61,2]   
gen min542_unempl = y[62,2]   
gen min543_unempl = y[63,2]   
gen min544_unempl = y[64,2]   
gen min612_unempl = y[65,2]   
gen min613_unempl = y[66,2]   
gen min614_unempl = y[67,2]   
gen min621_unempl = y[68,2]   
gen min622_unempl = y[69,2]   
gen min623_unempl = y[70,2]   
gen min624_unempl = y[71,2]   
gen min711_unempl = y[72,2]   
gen min712_unempl = y[73,2]   
gen min713_unempl = y[74,2]   
gen min721_unempl = y[75,2]   
gen min722_unempl = y[76,2]   
gen min811_unempl = y[77,2]   
gen min812_unempl = y[78,2]   
gen min813_unempl = y[79,2]   
gen min814_unempl = y[80,2]   
gen min821_unempl = y[81,2]   
gen min822_unempl = y[82,2]   
gen min823_unempl = y[83,2]   
gen min911_unempl = y[84,2]   
gen min912_unempl = y[85,2]   
gen min913_unempl = y[86,2]   
gen min921_unempl = y[87,2]   
gen min923_unempl = y[88,2]   
gen min924_unempl = y[89,2]   
gen min925_unempl = y[90,2]   
gen min926_unempl = y[91,2]   
gen min927_unempl = y[92,2]  

qui foreach j in 111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active = min`j'_empl + min`j'_unempl
}


qui foreach j in  111 112 113 115 116 117 118 119 121 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our = min`j'_unempl / min`j'_active
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_octdec19
save "./ourmin_combined_octdec19", replace
restore


use "UKDA-8671-stata/stata/stata13/lfsp_aj20_eul_pwt20", clear // Apr-Jun20

drop if AGE <15 | AGE >65

keep ILODEFR SC10LMJ SC10MMJ SC10LMN SC10MMN SEX PWT20

tab SC10MMJ ILODEFR  [aw=PWT20], matcell(x)

matrix list x

gen maj1_empl = x[3,1]
gen maj2_empl = x[4,1]
gen maj3_empl = x[5,1]
gen maj4_empl = x[6,1]
gen maj5_empl = x[7,1]
gen maj6_empl = x[8,1]
gen maj7_empl = x[9,1]
gen maj8_empl = x[10,1]
gen maj9_empl = x[11,1]


tab SC10LMJ ILODEFR [aw=PWT20], matcell(y)

matrix list y

gen maj1_unempl = y[3,2]
gen maj2_unempl = y[4,2]
gen maj3_unempl = y[5,2]
gen maj4_unempl = y[6,2]
gen maj5_unempl = y[7,2]
gen maj6_unempl = y[8,2]
gen maj7_unempl = y[9,2]
gen maj8_unempl = y[10,2]
gen maj9_unempl = y[11,2]


qui forval j = 1/9  {
gen maj`j'_active = maj`j'_empl + maj`j'_unempl
}


qui forval j = 1/9  {
gen maj`j'_our = maj`j'_unempl / maj`j'_active
}


preserve
keep maj*_our*

duplicates drop maj*, force
xpose , clear varname
rename v1 our_aprjun20
save "./our_combined_aprjun20", replace
restore

tab SC10MMN ILODEFR  [aw=PWT20], matcell(x)

matrix list x

gen min111_empl = x[3,1]  
gen min112_empl = x[4,1]  
gen min113_empl = x[5,1]  
gen min115_empl = x[6,1]  
gen min116_empl = x[7,1]  
gen min117_empl = x[8,1]  
gen min118_empl = x[9,1]  
gen min119_empl = x[10,1]  
gen min121_empl = x[11,1]  
gen min122_empl = x[12,1]  
gen min124_empl = x[13,1]  
gen min125_empl = x[14,1]  
gen min211_empl = x[15,1]  
gen min212_empl = x[16,1]  
gen min213_empl = x[17,1]  
gen min214_empl = x[18,1]  
gen min215_empl = x[19,1]  
gen min221_empl = x[20,1]  
gen min222_empl = x[21,1]  
gen min223_empl = x[22,1]  
gen min231_empl = x[23,1]  
gen min241_empl = x[24,1]  
gen min242_empl = x[25,1]  
gen min243_empl = x[26,1]  
gen min244_empl = x[27,1]  
gen min245_empl = x[28,1]  
gen min246_empl = x[29,1]  
gen min247_empl = x[30,1]  
gen min311_empl = x[31,1]  
gen min312_empl = x[32,1]  
gen min313_empl = x[33,1]  
gen min321_empl = x[34,1]  
gen min323_empl = x[35,1]  
gen min331_empl = x[36,1]  
gen min341_empl = x[37,1]  
gen min342_empl = x[38,1]  
gen min344_empl = x[39,1]  
gen min351_empl = x[40,1]  
gen min352_empl = x[41,1]  
gen min353_empl = x[42,1]  
gen min354_empl = x[43,1]  
gen min355_empl = x[44,1]  
gen min356_empl = x[45,1]  
gen min411_empl = x[46,1]  
gen min412_empl = x[47,1]  
gen min413_empl = x[48,1]  
gen min415_empl = x[49,1]  
gen min416_empl = x[50,1]  
gen min421_empl = x[51,1]  
gen min511_empl = x[52,1]  
gen min521_empl = x[53,1]  
gen min522_empl = x[54,1]  
gen min523_empl = x[55,1]  
gen min524_empl = x[56,1]  
gen min525_empl = x[57,1]  
gen min531_empl = x[58,1]  
gen min532_empl = x[59,1]  
gen min533_empl = x[60,1]  
gen min541_empl = x[61,1]  
gen min542_empl = x[62,1]  
gen min543_empl = x[63,1]  
gen min544_empl = x[64,1]  
gen min612_empl = x[65,1]  
gen min613_empl = x[66,1]  
gen min614_empl = x[67,1]  
gen min621_empl = x[68,1]  
gen min622_empl = x[69,1]  
gen min623_empl = x[70,1]  
gen min624_empl = x[71,1]  
gen min711_empl = x[72,1]  
gen min712_empl = x[73,1]  
gen min713_empl = x[74,1]  
gen min721_empl = x[75,1]  
gen min722_empl = x[76,1]  
gen min811_empl = x[77,1]  
gen min812_empl = x[78,1]  
gen min813_empl = x[79,1]  
gen min814_empl = x[80,1]  
gen min821_empl = x[81,1]  
gen min822_empl = x[82,1]  
gen min823_empl = x[83,1]  
gen min911_empl = x[84,1]  
gen min912_empl = x[85,1]  
gen min913_empl = x[86,1]  
gen min921_empl = x[87,1]  
gen min923_empl = x[88,1]  
gen min924_empl = x[89,1]  
gen min925_empl = x[90,1]  
gen min926_empl = x[91,1]  
gen min927_empl = x[92,1]  


tab SC10LMN ILODEFR  [aw=PWT20], matcell(y)

matrix list y

gen min111_unempl = y[3,2]  
gen min112_unempl = y[4,2]  
gen min113_unempl = y[5,2]  
gen min115_unempl = y[6,2]  
gen min116_unempl = y[7,2]  
gen min117_unempl = y[8,2]  
gen min118_unempl = y[9,2]  
gen min119_unempl = y[10,2]  
gen min122_unempl = y[11,2]  
gen min124_unempl = y[12,2]  
gen min125_unempl = y[13,2]  
gen min211_unempl = y[14,2]  
gen min212_unempl = y[15,2]  
gen min213_unempl = y[16,2]  
gen min214_unempl = y[17,2]  
gen min215_unempl = y[18,2]  
gen min221_unempl = y[19,2]  
gen min222_unempl = y[20,2]  
gen min223_unempl = y[21,2]  
gen min231_unempl = y[22,2]  
gen min241_unempl = y[23,2]  
gen min242_unempl = y[24,2]  
gen min243_unempl = y[25,2]  
gen min244_unempl = y[26,2]  
gen min245_unempl = y[27,2]  
gen min246_unempl = y[28,2]  
gen min247_unempl = y[29,2]  
gen min311_unempl = y[30,2]  
gen min312_unempl = y[31,2]  
gen min313_unempl = y[32,2]  
gen min321_unempl = y[33,2]  
gen min323_unempl = y[34,2]  
gen min331_unempl = y[35,2]  
gen min341_unempl = y[36,2]  
gen min342_unempl = y[37,2]  
gen min344_unempl = y[38,2]  
gen min351_unempl = y[39,2]  
gen min352_unempl = y[40,2]  
gen min353_unempl = y[41,2]  
gen min354_unempl = y[42,2]  
gen min355_unempl = y[43,2]  
gen min356_unempl = y[44,2]  
gen min411_unempl = y[45,2]  
gen min412_unempl = y[46,2]  
gen min413_unempl = y[47,2]  
gen min415_unempl = y[48,2]  
gen min416_unempl = y[49,2]  
gen min421_unempl = y[50,2]  
gen min511_unempl = y[51,2]  
gen min521_unempl = y[52,2]  
gen min522_unempl = y[53,2]  
gen min523_unempl = y[54,2]  
gen min524_unempl = y[55,2]  
gen min525_unempl = y[56,2]  
gen min531_unempl = y[57,2]  
gen min532_unempl = y[58,2]  
gen min533_unempl = y[59,2]  
gen min541_unempl = y[60,2]  
gen min542_unempl = y[61,2]  
gen min543_unempl = y[62,2]  
gen min544_unempl = y[63,2]  
gen min612_unempl = y[64,2]  
gen min613_unempl = y[65,2]  
gen min614_unempl = y[66,2]  
gen min621_unempl = y[67,2]  
gen min622_unempl = y[68,2]  
gen min623_unempl = y[69,2]  
gen min624_unempl = y[70,2]  
gen min711_unempl = y[71,2]  
gen min712_unempl = y[72,2]  
gen min713_unempl = y[73,2]  
gen min721_unempl = y[74,2]  
gen min722_unempl = y[75,2]  
gen min811_unempl = y[76,2]  
gen min812_unempl = y[77,2]  
gen min813_unempl = y[78,2]  
gen min814_unempl = y[79,2]  
gen min821_unempl = y[80,2]  
gen min822_unempl = y[81,2]  
gen min823_unempl = y[82,2]  
gen min911_unempl = y[83,2]  
gen min912_unempl = y[84,2]  
gen min913_unempl = y[85,2]  
gen min921_unempl = y[86,2]  
gen min923_unempl = y[87,2]  
gen min924_unempl = y[88,2]  
gen min925_unempl = y[89,2]  
gen min926_unempl = y[90,2]  
gen min927_unempl = y[91,2]  

qui foreach j in 111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927  {
gen min`j'_active = min`j'_empl + min`j'_unempl
}



qui foreach j in  111 112 113 115 116 117 118 119 122 124 125 211 212 213 214 215 221 222 223 231 241 242 243 244 245 246 247 311 312 313 321 323 331 341 342 344 351 352 353 354 356 411 412 413 415 416 421 511 521 522 523 524 525 531 532 533 541 542 543 544 612 613 614 621 622 623 624 711 712 713 721 722 811 812 813 814 821 822 823 911 912 913 921 923 924 925 926 927 {
gen min`j'_our = min`j'_unempl / min`j'_active
}

preserve
keep min*_our* 

duplicates drop min*, force
xpose , clear varname
rename v1 our_aprjun20
save "./ourmin_combined_aprjun20", replace
restore


use "./our_combined_aprjun18", clear
merge 1:1 _varname using "./our_combined_janmar19"
drop _merge
merge 1:1 _varname using  "./our_combined_octdec19"
drop _merge
merge 1:1 _varname using "./our_combined_aprjun20"
drop _merge
order _varname 
rename _varname soc_major

replace soc_major = substr(soc_major, 1,4)
replace soc_major = substr(soc_major, 4,4)
destring soc_major, replace

save "./our_combined.dta", replace
export delimited "./our_combined.txt", delimiter(tab) replace

rm "./our_combined_aprjun18.dta"
rm "./our_combined_janmar19.dta"
rm "./our_combined_octdec19.dta"
rm "./our_combined_aprjun20.dta"


use "./ourmin_combined_aprjun18", clear
merge 1:1 _varname using "./ourmin_combined_janmar19"
drop _merge
merge 1:1 _varname using  "./ourmin_combined_octdec19"
drop _merge
merge 1:1 _varname using "./ourmin_combined_aprjun20"
drop _merge
order _varname 
rename _varname soc_minor

replace soc_minor = substr(soc_minor, 1,6)
replace soc_minor = substr(soc_minor, 4,6)
destring soc_minor, replace

save "./ourmin_combined.dta", replace
export delimited "./ourmin_combined.txt", delimiter(tab) replace

rm "./ourmin_combined_aprjun18.dta"
rm "./ourmin_combined_janmar19.dta"
rm "./ourmin_combined_octdec19.dta"
rm "./ourmin_combined_aprjun20.dta"
